diff --git a/changelog/v0.2.19.md b/changelog/v0.2.19.md new file mode 100644 index 0000000..9af89f7 --- /dev/null +++ b/changelog/v0.2.19.md @@ -0,0 +1,11 @@ +# v0.2.19 + +Chinese, Korean and Japanese added to the console and prompt translations. + +## Added + +- The console language switch now offers Chinese, Korean and Japanese in addition + to English, Hindi and Bengali. +- The gateway default prompt accepts `zh`, `ko` and `ja` translations. A request's + `Accept-Language` selects the matching text, with the default as fallback. +- The Configuration prompt editor exposes all five translated variants. diff --git a/docs/ADMIN-UI.md b/docs/ADMIN-UI.md index e4eaf17..39be92e 100644 --- a/docs/ADMIN-UI.md +++ b/docs/ADMIN-UI.md @@ -15,8 +15,9 @@ provider API key, probe, delete), routes (add a model, enable/disable, delete), (create with budgets and allowlists, top up, revoke), **configuration** (the gateway switches, the default system prompt, alert email and the daily digest) and **settings** (the session: identity, scopes, token, sign out). The sidebar language selector switches -the console between English, Hindi and Bengali and remembers the choice per browser; the -Configuration prompt editor stores Hindi/Bengali variants selected by `Accept-Language`. +the console between English, Hindi, Bengali, Chinese, Korean and Japanese and remembers +the choice per browser; the Configuration prompt editor stores the matching variants +selected by `Accept-Language`. ## Auth diff --git a/docs/API.md b/docs/API.md index 768be6d..4ad6693 100644 --- a/docs/API.md +++ b/docs/API.md @@ -111,9 +111,9 @@ curl -s -X PUT http://localhost:8080/admin/system-prompt \ `text` accepts up to 100,000 characters. Enabling with blank text returns 400; disabling keeps the stored text. The console edits this same endpoint and reads the live limit from -`max_chars`. `translations` accepts `hi` and `bn`; a request's `Accept-Language` selects -one, and an absent/blank translation falls back to `text`. `GET /admin/system-prompt` -returns the stored `translations` map. +`max_chars`. `translations` accepts `hi`, `bn`, `zh`, `ko` and `ja`; a request's +`Accept-Language` selects one, and an absent/blank translation falls back to `text`. +`GET /admin/system-prompt` returns the stored `translations` map. **Non-streaming** diff --git a/path-gateway/pom.xml b/path-gateway/pom.xml index 8b38759..08ecc50 100644 --- a/path-gateway/pom.xml +++ b/path-gateway/pom.xml @@ -7,7 +7,7 @@ io.github.an1ndra path-parent - 0.2.18 + 0.2.19 ../pom.xml diff --git a/path-gateway/src/main/java/com/anindra/path/admin/SystemPromptService.java b/path-gateway/src/main/java/com/anindra/path/admin/SystemPromptService.java index ba4e27d..35cd598 100644 --- a/path-gateway/src/main/java/com/anindra/path/admin/SystemPromptService.java +++ b/path-gateway/src/main/java/com/anindra/path/admin/SystemPromptService.java @@ -42,7 +42,7 @@ public class SystemPromptService { /** Large enough for a full upstream prompt; the Claude Code core prompt is ~18k. */ public static final int MAX_CHARS = 100_000; private static final Duration CACHE_TTL = Duration.ofSeconds(5); - private static final Set SUPPORTED = Set.of("en", "hi", "bn"); + private static final Set SUPPORTED = Set.of("en", "hi", "bn", "zh", "ko", "ja"); private final SystemPromptSettingsRepository repository; private final SystemPromptTranslationRepository translations; @@ -130,7 +130,7 @@ public Map save(String text, Boolean enabled, Map MAX_CHARS) { throw ApiException.badRequest( @@ -203,7 +203,7 @@ private Cached load() { return loaded; } - /** en is the default text; hi/bn are stored translations. */ + /** en is the default text; the other supported tags are stored translations. */ private static String pickLocale(String acceptLanguage) { if (acceptLanguage == null || acceptLanguage.isBlank()) { return null; diff --git a/path-gateway/src/test/java/com/anindra/path/admin/SystemPromptServiceTest.java b/path-gateway/src/test/java/com/anindra/path/admin/SystemPromptServiceTest.java index 87466b8..e077a42 100644 --- a/path-gateway/src/test/java/com/anindra/path/admin/SystemPromptServiceTest.java +++ b/path-gateway/src/test/java/com/anindra/path/admin/SystemPromptServiceTest.java @@ -71,12 +71,21 @@ void disabledPromptLeavesTheRequestUntouched() throws Exception { void acceptLanguageSelectsStoredTranslation() throws Exception { service.save("Default policy.", true, java.util.Map.of( "hi", "हिन्दी नीति।", - "bn", "বাংলা নীতি।")); + "bn", "বাংলা নীতি।", + "zh", "中文政策。", + "ko", "한국어 정책.", + "ja", "日本語ポリシー。")); assertThat(service.apply(body(), "hi-IN,hi;q=0.9").path("messages").get(0).path("content").asText()) .isEqualTo("हिन्दी नीति।"); assertThat(service.apply(body(), "bn").path("messages").get(0).path("content").asText()) .isEqualTo("বাংলা নীতি।"); + assertThat(service.apply(body(), "zh-CN").path("messages").get(0).path("content").asText()) + .isEqualTo("中文政策。"); + assertThat(service.apply(body(), "ko-KR").path("messages").get(0).path("content").asText()) + .isEqualTo("한국어 정책."); + assertThat(service.apply(body(), "ja-JP").path("messages").get(0).path("content").asText()) + .isEqualTo("日本語ポリシー。"); // English and unsupported languages fall back to the default text. assertThat(service.apply(body(), "fr-FR").path("messages").get(0).path("content").asText()) .isEqualTo("Default policy."); diff --git a/path-spring-ai/pom.xml b/path-spring-ai/pom.xml index a2b17a0..f738c66 100644 --- a/path-spring-ai/pom.xml +++ b/path-spring-ai/pom.xml @@ -7,7 +7,7 @@ io.github.an1ndra path-parent - 0.2.18 + 0.2.19 ../pom.xml diff --git a/pom.xml b/pom.xml index 0913703..ea5ceb3 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ io.github.an1ndra path-parent - 0.2.18 + 0.2.19 pom path-parent Build parent for Path, the provider-agnostic LLM gateway, and its Spring AI adapter