feat: configure an independent OpenAI translation model

This commit is contained in:
Blendman974 committed 2026-11-08 00:48:54 +01:00
1 parent 6df52021c8
commit 69bb92da7b
5 files changed
+52 -9

No files matched your search

+8 -2
View File
@@ -1,6 +1,6 @@
/**
* Streamed translation against the assistant's configured model (Settings >
* Assistant). Each call translates one stretch of speech into English; see
* Streamed translation against Translate's OpenAI override, or the assistant's
* configured model when no override is set. Each call translates one stretch of speech into English; see
* TranslationModel for how stretches are batched and given context.
*/
import { streamAnthropicMessage } from "../../native/anthropic";
@@ -14,6 +14,7 @@ import {
assistantOpenAiCompatibleModelSetting, assistantOpenAiCompatibleUrlSetting, openAiApiKeySetting,
} from "../../ui/dashboard-settings";
import { TRANSLATE_SYSTEM_PROMPT, buildTranslateUserMessage } from "../../prompts";
import { translateModelSetting } from "./translate-settings";
import { type TranslationTurn } from "./translation-model";
/**
@@ -23,6 +24,11 @@ import { type TranslationTurn } from "./translation-model";
* for whichever API key is set, else the on-phone model.
*/
export function resolveTranslationModel(): ResolvedAssistantModel | null {
const translationModel = translateModelSetting.get().trim();
if (translationModel) {
const apiKey = openAiApiKeySetting.get().trim();
return apiKey ? { selection: "auto", provider: "openai", model: translationModel, apiKey } : null;
}
const selection = assistantModelSetting.get();
return resolveAssistantModel(selection === "hermes" ? "auto" : selection, {
anthropic: anthropicApiKeySetting.get(),