1
0
Fork 0

feat: AI 텍스트 Provider (LlmProvider) — OpenAI/Anthropic 요약·번역·교정

AI를 '키 없으면 비활성되는 부가 엣지'로 통합. 기존 변환에 무영향, 일반 변환과 충돌 없는 txt↔txt/md↔md self-edge만 노출.

- IChatClient + OpenAiChatClient/AnthropicChatClient (HttpClient 직접, SDK 의존 0)
- LlmProvider: summarize/translate/proofread/custom, ISettingsStore 키 + 환경변수(OPENAI_API_KEY/ANTHROPIC_API_KEY) 폴백
- CheckAvailabilityAsync 게이트: 키 없으면 NotReady → 그래프에서 실행 비활성
- ConvertOptions.Ai (백엔드/모델/작업/대상언어)
- 테스트 5개 (키 게이트·프롬프트 구성·그래프 엣지) — 총 34개 통과
This commit is contained in:
Yun Chan 2026-06-01 13:21:14 +09:00
parent 937d9e7878
commit b76d51f3c1
6 changed files with 313 additions and 0 deletions

View file

@ -66,6 +66,8 @@ public sealed class ConvertOptions
public PdfCompressOptions PdfCompress { get; set; } = new();
public AiOptions Ai { get; set; } = new();
public static ConvertOptions Quick() => new();
}
@ -140,3 +142,23 @@ public sealed class PdfCompressOptions
/// <summary>Light(구조 최적화·무손실) | Strong(렌더 재인코딩) | Max(Ghostscript). P1은 Light만 구현.</summary>
public string Level { get; set; } = "Light";
}
public sealed class AiOptions
{
/// <summary>auto | openai | anthropic. auto는 설정된 키 중 가용한 것을 선택.</summary>
public string Backend { get; set; } = "auto";
/// <summary>모델 ID. null이면 백엔드별 기본값.</summary>
public string? Model { get; set; }
/// <summary>summarize | translate | proofread | custom.</summary>
public string Task { get; set; } = "summarize";
/// <summary>translate 작업의 대상 언어 (예: "영어", "일본어").</summary>
public string? TargetLanguage { get; set; }
/// <summary>custom 작업의 사용자 지정 지시문.</summary>
public string? Instruction { get; set; }
public int MaxOutputTokens { get; set; } = 2000;
}