Commit 053dec24 authored by platyhouse's avatar platyhouse

# AI CLI 도구 기능 개선

## 설정 파일 편집 기능 추가

- ptyAIGetMessage.php: `--edit` 옵션 추가 - vi 에디터로 ~/.ptyAIConfig.ini 설정 파일 직접 편집 가능

## AI API 통계 조회 도구 신규 추가

- ptyAIStatistics.php: AI API 섹션별 사용량 및 비용 통계 조회 CLI 도구 신규 작성
  - 지원 provider: anthropic, openai, google, ollama
  - Anthropic: Admin API를 통한 사용량/비용 통계 조회 (adminApiKey 필요)
  - OpenAI: Usage/Costs API를 통한 사용량/비용 조회 및 모델 목록
  - Google: Gemini 모델 목록 및 토큰 제한 정보 조회
  - Ollama: 로컬 모델 목록 및 실행 중인 모델 상태 조회
  - 옵션: `--ai`, `--days`, `--daily`, `--verbose`, `--json`, `--edit`, `--help`
parent f3fd6732
...@@ -30,6 +30,13 @@ $anthropicBetaOverride = $options['anthropic-beta'] ?? null; ...@@ -30,6 +30,13 @@ $anthropicBetaOverride = $options['anthropic-beta'] ?? null;
$verbose = isset($options['verbose']); $verbose = isset($options['verbose']);
$jsonOutput = isset($options['json']); $jsonOutput = isset($options['json']);
// --edit 옵션: vi로 설정 파일 열기
if (isset($options['edit'])) {
$configPath = ptyAIConfig::getConfigPath();
passthru("vi " . escapeshellarg($configPath));
exit(0);
}
// 도움말 또는 필수 인자 확인 // 도움말 또는 필수 인자 확인
if (empty($positionalArgs) || isset($options['help'])) { if (empty($positionalArgs) || isset($options['help'])) {
fwrite(STDERR, "사용법: {$argv[0]} \"메시지\" [옵션]\n"); fwrite(STDERR, "사용법: {$argv[0]} \"메시지\" [옵션]\n");
...@@ -40,6 +47,7 @@ if (empty($positionalArgs) || isset($options['help'])) { ...@@ -40,6 +47,7 @@ if (empty($positionalArgs) || isset($options['help'])) {
fwrite(STDERR, " --anthropic-beta=기능명 Claude 베타 기능 오버라이드\n"); fwrite(STDERR, " --anthropic-beta=기능명 Claude 베타 기능 오버라이드\n");
fwrite(STDERR, " --verbose 상세 정보 출력 (토큰 사용량, curl 등)\n"); fwrite(STDERR, " --verbose 상세 정보 출력 (토큰 사용량, curl 등)\n");
fwrite(STDERR, " --json JSON 형식으로 출력\n"); fwrite(STDERR, " --json JSON 형식으로 출력\n");
fwrite(STDERR, " --edit 설정 파일을 vi로 열기\n");
fwrite(STDERR, " --help 도움말 출력\n"); fwrite(STDERR, " --help 도움말 출력\n");
fwrite(STDERR, "\n"); fwrite(STDERR, "\n");
fwrite(STDERR, "모델 예시:\n"); fwrite(STDERR, "모델 예시:\n");
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment