Skip to content

Commit c8d03e1

Browse files
committed
Change config file, add support to change MaxConcurrency in ConfigLLM.yaml
1 parent 8d444bd commit c8d03e1

8 files changed

Lines changed: 16 additions & 82 deletions

File tree

XUnity.AutoTranslator.LlmTranslators/Config/Configuration.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ public class LlmConfig
99
public string? ApiKey { get; set; }
1010
public string Url { get; set; } = string.Empty;
1111
public string Model { get; set; } = string.Empty;
12+
public int? MaxConcurrency { get; set; }
1213
public string SystemPrompt { get; set; } = string.Empty;
1314
public string GlossaryPrompt { get; set; } = string.Empty;
1415
public Dictionary<string, object> ModelParams { get; set; } = new Dictionary<string, object>();

XUnity.AutoTranslator.LlmTranslators/LLMTranslateEndpoint.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class LLMTranslatorEndpoint : HttpEndpoint
1212
public override int MaxTranslationsPerRequest => 1;
1313

1414
// Careful not to melt machines
15-
public override int MaxConcurrency => 5;
15+
public override int MaxConcurrency => _config.MaxConcurrency ?? 5;
1616

1717
private LlmConfig _config = new();
1818

XUnity.AutoTranslator.LlmTranslators/SampleConfig/Config.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[Service]
2-
Endpoint=OpenAiTranslate
2+
Endpoint=LLMEndpoint
33
FallbackEndpoint=
44

55
[General]

XUnity.AutoTranslator.LlmTranslators/SampleConfig/OpenAi.yaml renamed to XUnity.AutoTranslator.LlmTranslators/SampleConfig/ConfigLLM.yaml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
apiKey: "Change me"
2-
apiKeyRequired: true
3-
url: "https://api.openai.com/v1/chat/completions"
4-
model: "gpt-4o-mini"
1+
## LLM configuration
2+
apiKey: "Change me or leave it blank if local endpoint"
3+
url: "api.deepseek.com"
4+
model: "deepseek-chat"
5+
maxConcurrency: 5 # Set how many translation request at the same time. Recommended to leave it at 5 or lower for local
56
modelParams:
67
temperature: 0.2
78
top_p: 0.9
@@ -12,4 +13,11 @@ systemPrompt: |
1213
glossaryPrompt: |
1314
#Glossary for Consistent Translations
1415
Use the translation for exact matches.
15-
## Terms
16+
## Terms
17+
glossaryLines:
18+
- raw: ゲーム
19+
result: Game
20+
- raw: 終了
21+
result: Exit
22+
- raw: 主人
23+
result: Master

XUnity.AutoTranslator.LlmTranslators/SampleConfig/Ollama.yaml

Lines changed: 0 additions & 60 deletions
This file was deleted.

XUnity.AutoTranslator.LlmTranslators/SampleConfig/OpenAi-Glossary.yaml

Lines changed: 0 additions & 5 deletions
This file was deleted.

XUnity.AutoTranslator.LlmTranslators/SampleConfig/OpenAi-GlossaryPrompt.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

XUnity.AutoTranslator.LlmTranslators/SampleConfig/OpenAi-SystemPrompt.txt

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)