feat: 入力言語に応じてプロンプトテンプレートを出し分ける - #5
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
franc-min で入力言語を判定し、日本語・英語・繁体字中国語・韓国語の system プロンプトを出し分ける。漢字だけの日本語(既存プリセットのクエリ形式) は franc が中国語と判定するため、中国語専用字の有無で日本語に戻している。 あわせて Exa の Web 検索上限を 5 件から 20 件に引き上げ、判定した言語を 測定結果の注記に表示する。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
yu23ki14
force-pushed
the
feat/multilingual-prompt-templates
branch
from
September 20, 2026 01:49
824f863 to
1de19cf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
やったこと
origin-flow の測定で、ユーザーが入力したナラティブの言語を判定し、system プロンプトを
日本語・英語・繁体字中国語・韓国語で出し分けるようにした。あわせて Web 検索の上限を
5 件から 20 件に引き上げた。
franc-minを追加(判定のみ、候補はjpn / eng / cmn / korに限定)app/lib/language.ts(新規)にdetectLanguage()/SYSTEM_PROMPTS/LANGUAGE_LABELを集約。レイアウト計算と同じく DOM に触らない純関数として置いた
api.measure.ts— system メッセージをテンプレートから引き、max_results: 5 → 20、判定結果を
preset.languageに載せて返すorigin-flow.tsx— 注記行に「プロンプト言語」を追加、フォーム下の説明を 20 件に更新漢字だけの日本語への対処
franc は仮名の有無で日本語を見るため、
自衛隊基地周辺 土地買収 規制のような漢字だけの日本語が
cmnに落ちる。これは既存プリセットのクエリ形式そのもので主用途に当たるため、cmnと判定されたときだけ、日本語の字体と重ならない中国語専用字(繁体們麼這嗎…/簡体
们这么个…)の有無を見て、含まなければ日本語に戻している。レビューで見てほしい前提
franc は繁体/簡体を区別しないので、簡体字入力も繁體中文テンプレートに流れる
確認
pnpm typecheck通過。detectLanguage()は上表の入力で動作確認済み。🤖 Generated with Claude Code