Skip to content
Merged
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
11 changes: 11 additions & 0 deletions changelog/v0.2.19.md
Original file line number Diff line number Diff line change
@@ -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.
5 changes: 3 additions & 2 deletions docs/ADMIN-UI.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**

Expand Down
2 changes: 1 addition & 1 deletion path-gateway/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.github.an1ndra</groupId>
<artifactId>path-parent</artifactId>
<version>0.2.18</version>
<version>0.2.19</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> SUPPORTED = Set.of("en", "hi", "bn");
private static final Set<String> SUPPORTED = Set.of("en", "hi", "bn", "zh", "ko", "ja");

private final SystemPromptSettingsRepository repository;
private final SystemPromptTranslationRepository translations;
Expand Down Expand Up @@ -130,7 +130,7 @@ public Map<String, Object> save(String text, Boolean enabled, Map<String, String
String locale = entry.getKey() == null ? "" : entry.getKey().trim().toLowerCase(Locale.ROOT);
if (!SUPPORTED.contains(locale) || locale.equals("en")) {
throw ApiException.badRequest(
"'translations' supports hi and bn.", "translations");
"'translations' supports hi, bn, zh, ko and ja.", "translations");
}
if (entry.getValue() != null && entry.getValue().length() > MAX_CHARS) {
throw ApiException.badRequest(
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
Expand Down
2 changes: 1 addition & 1 deletion path-spring-ai/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.github.an1ndra</groupId>
<artifactId>path-parent</artifactId>
<version>0.2.18</version>
<version>0.2.19</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<groupId>io.github.an1ndra</groupId>
<artifactId>path-parent</artifactId>
<version>0.2.18</version>
<version>0.2.19</version>
<packaging>pom</packaging>
<name>path-parent</name>
<description>Build parent for Path, the provider-agnostic LLM gateway, and its Spring AI adapter</description>
Expand Down