Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
"config.namespace": "Enable namespaces. Check out the docs for more details.",
"config.openai_api_key": "OpenAI API key",
"config.openai_api_model": "OpenAI chatgpt model",
"config.openai_custom_api_model": "OpenAI custom chatgpt model",
"config.openai_api_root": "OpenAI API root URL",
"config.path_matcher": "Match path for custom locale/namespace. Check out the docs for more details.",
"config.preferred_delimiter": "Preferred delimiter of composed keypath, default to \"-\"(dash)",
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1127,6 +1127,11 @@
],
"description": "%config.openai_api_model%"
},
"i18n-ally.translate.openai.customApiModel": {
"type": "string",
"default": null,
"description": "%config.openai_custom_api_model%"
},
"i18n-ally.usage.scanningIgnore": {
"type": "array",
"items": {
Expand Down
6 changes: 5 additions & 1 deletion src/core/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ export class Config {
return this.getConfig<SortCompare>('sortCompare') || 'binary'
}

static get sortLocale(): string | undefined{
static get sortLocale(): string | undefined {
return this.getConfig<string>('sortLocale')
}

Expand Down Expand Up @@ -584,6 +584,10 @@ export class Config {
return this.getConfig<string>('translate.openai.apiModel') ?? 'gpt-3.5-turbo'
}

static get openaiCustomApiModel() {
return this.getConfig<string>('translate.openai.customApiModel') ?? ''
}

static get telemetry(): boolean {
return workspace.getConfiguration().get('telemetry.enableTelemetry') as boolean
}
Expand Down
2 changes: 1 addition & 1 deletion src/translators/engines/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default class OpenAITranslate extends TranslateEngine {
let apiKey = Config.openaiApiKey;
let apiRoot = this.apiRoot;
if (Config.openaiApiRoot) apiRoot = Config.openaiApiRoot.replace(/\/$/, "");
let model = Config.openaiApiModel;
let model = Config.openaiCustomApiModel.length > 0 ? Config.openaiCustomApiModel : Config.openaiApiModel;

const response = await axios.post(
`${apiRoot}/v1/chat/completions`,
Expand Down