Skip to content

Commit ad83f95

Browse files
Project import generated by Copybara. (#227)
* Project import generated by Copybara. GitOrigin-RevId: 289721113a36ee612e1762db70c0d64ad5c1b572 * Use cross-env to set PYTHONPATH. * Revert dependabot.yml. * Replace double brackets with curly braces in Jinja templates. --------- Co-authored-by: Project Voice <project-voice-copybara@google.com>
1 parent 8c1f70c commit ad83f95

20 files changed

+1322
-584
lines changed

macro.py

Lines changed: 13 additions & 574 deletions
Large diffs are not rendered by default.

package-lock.json

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"watch": "npm run build:i18n && esbuild src/index.ts --bundle --watch --define:process.env.NODE_ENV=\\\"development\\\" --outfile=static/index.js",
1414
"fix": "gts fix 'src/**/*.ts' && python -m yapf -i *.py tools/*.py",
1515
"pretest": "esbuild src/tests/test_index.ts --bundle --outfile=spec/test_bundle.js",
16-
"test": "jasmine-browser-runner runSpecs",
16+
"test:js": "jasmine-browser-runner runSpecs",
17+
"test": "concurrently \"npm run test:js\" \"cross-env PYTHONPATH=. pytest -vv\"",
1718
"deploy": "npm run build && gcloud app deploy app.yaml --no-promote",
1819
"postinstall": "python -m pip install -r requirements.txt && python -m pip install -r requirements-dev.txt",
1920
"storybook": "storybook dev -p 6006"
@@ -31,6 +32,7 @@
3132
"@types/jasmine": "^5.1.9",
3233
"@types/node": "^24.3.1",
3334
"concurrently": "^9.2.1",
35+
"cross-env": "^10.1.0",
3436
"esbuild": "^0.25.2",
3537
"eslint-plugin-simple-import-sort": "^12.1.1",
3638
"eslint-plugin-storybook": "^9.1.5",

requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
ipadic
22
mecab-python3
3+
pytest
34
retry
45
tinysegmenter
56
yapf

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ flask-cors
33
flask-seasurf
44
google-genai
55
gunicorn
6+
jinja2

src/language.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ abstract class LatinScriptLanguage implements Language {
9191
emotions: {emoji: string; prompt: string; label?: string}[] = [];
9292
aiConfigs = {
9393
classic: {
94-
model: 'gemini-1.5-pro-002',
94+
model: 'gemini-2.0-flash-001',
9595
sentence: 'SentenceGeneric20250311',
9696
word: 'WordGeneric20240628',
9797
},
@@ -106,7 +106,7 @@ abstract class LatinScriptLanguage implements Language {
106106
word: 'WordGeneric20240628',
107107
},
108108
gemini_2_5_flash: {
109-
model: 'gemini-2.5-flash-preview-05-20',
109+
model: 'gemini-2.5-flash',
110110
sentence: 'SentenceGeneric20250311',
111111
word: 'WordGeneric20240628',
112112
},
@@ -200,12 +200,12 @@ abstract class Japanese implements Language {
200200
];
201201
aiConfigs = {
202202
classic: {
203-
model: 'gemini-1.5-flash-002',
203+
model: 'gemini-2.5-flash',
204204
sentence: 'SentenceJapanese20240628',
205205
word: 'WordGeneric20240628',
206206
},
207207
fast: {
208-
model: 'gemini-1.5-flash-002',
208+
model: 'gemini-2.5-flash-lite',
209209
sentence: 'SentenceJapanese20240628',
210210
word: 'WordGeneric20240628',
211211
},
@@ -215,7 +215,7 @@ abstract class Japanese implements Language {
215215
word: 'WordJapanese20250623',
216216
},
217217
gemini_2_5_flash: {
218-
model: 'gemini-2.5-flash-preview-05-20',
218+
model: 'gemini-2.5-flash',
219219
sentence: 'SentenceJapaneseLong20250603',
220220
word: 'WordGeneric20240628',
221221
},
@@ -376,22 +376,22 @@ abstract class Mandarin implements Language {
376376
initialPhrases = ['你', '我', '他', '她', '它', '好', '今天', '昨天', '明天'];
377377
aiConfigs = {
378378
classic: {
379-
model: 'gemini-1.5-flash-002',
379+
model: 'gemini-2.5-flash',
380380
sentence: 'SentenceMandarin20250616',
381381
word: 'WordMandarin20250616',
382382
},
383383
fast: {
384-
model: 'gemini-1.5-flash-002',
384+
model: 'gemini-2.5-flash-lite',
385385
sentence: 'SentenceMandarin20250616',
386386
word: 'WordMandarin20250616',
387387
},
388388
smart: {
389-
model: 'gemini-1.5-pro-002',
389+
model: 'gemini-2.5-flash',
390390
sentence: 'SentenceMandarin20250616',
391391
word: 'WordMandarin20250616',
392392
},
393393
gemini_2_5_flash: {
394-
model: 'gemini-2.5-flash-preview-05-20',
394+
model: 'gemini-2.5-flash',
395395
sentence: 'SentenceMandarin20250616',
396396
word: 'WordMandarin20250616',
397397
},
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{% if lastInputSpeech %}
2+
You are talking with your partner. The conversation is as follows:
3+
{% if lastOutputSpeech %}
4+
You:
5+
{{ lastOutputSpeech }}
6+
{% endif %}
7+
Partner:
8+
{{ lastInputSpeech }}
9+
10+
{% if conversationHistory %}
11+
Here is the conversation history:
12+
{{ conversationHistory }}
13+
{% endif %}
14+
15+
Considering this context, please guess and generate a list of {{ num }} different sentences that start with "{{ text }}".
16+
{% else %}
17+
Please guess and generate a list of {{ num }} different sentences that start with "{{ text }}".
18+
{% endif %}
19+
{% if sentenceEmotion %}
20+
21+
Note that the user has indicated their intention to input a {{ sentenceEmotion }} sentence.
22+
{% endif %}
23+
24+
Please note the word I provide may not be complete, so use your best guess. Each answer must start with an index number, and each answer should start with different word to cover wider topics. The response should be in {{ language }}. Those sentences should not be the same. Do not highlight answers with asterisk. Since your output will be used as the user's input, do not include any extra notes, labels or explanations in your output.
25+
The answer should be in {{ language }}.
26+
{% if persona %}
27+
28+
FYI: The user's profile is as follows:
29+
{{ persona }}
30+
{% endif %}
31+
32+
Answer:
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
「{{ text }}」で始まる{{ num }}つの異なる文を推測してリストを作成してください。各回答はインデックス番号で始まる必要があります。それらの文は同じであってはなりません。文中の単語が間違っている可能性もあるため、できるだけ正確に推測してください。回答を強調表示しないでください。
2+
{% if persona %}
3+
4+
参考までに、このユーザのプロフィールは以下のとおりです:
5+
{{ persona }}
6+
{% endif %}
7+
{% if conversationHistory %}
8+
9+
以下はユーザとその相手との会話の履歴です:
10+
{{ conversationHistory }}
11+
{% endif %}
12+
13+
回答:
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
あなたは利用者の言わんとしようとしていることを補助する役割を担います。利用者が入力する短いテキストから続く文章(句点「。」、感嘆符「!」、疑問符「?」のいずれかで終わるもの)を作成してください。「{{ text }}」で始まる{{ num }}つの異なる文を推測してリストを作成してください。実際に言いそう、有り得そうな文章のトップ{{ num }}を生成してください。肯定文、疑問文(依頼含む)、否定文が混在していると理想です。想定を含めた場合も{{ num }}つ以上の回答は不要です。あなたの出力はそのままユーザーの入力内容として使用されるので、出力には余分な補足や説明は一切含めないでください。
2+
3+
以下ルールです。
4+
- 各回答はインデックス番号で始まる必要があります。
5+
- 「{{ text }}」は入力途中である場合もあります。1文字から2文字補完したうえでの想定も加えてください。名前など、固有名詞であるケースも想定してください。
6+
- 「{{ text }}」の文章は通常漢字やカタカナで書かれるものが、ひらがなのままなケースもあります。「漢字、あるいはカタカナで書いてあれば」という想定もしてください。漢字であることを想定して作成した回答では、回答内の表示も想定した漢字で表記してください。その際どう想定したか、という補足や読みの説明は不要です。
7+
- 「{{ text }}」に続く最初の単語、または助詞は回答ごとに極力異なるものにしてください。
8+
- 「{{ text }}」には入力ミスが含まれている可能性もありますが、「{{ text }}」に続く一般的な文章が思いつかない場合にのみ、入力ミスを想定したうえで提案してください。
9+
{% if persona %}
10+
11+
参考までに、このユーザのプロフィールは以下のとおりです:
12+
{{ persona }}
13+
{% endif %}
14+
{% if conversationHistory %}
15+
16+
以下はユーザとその相手との会話の履歴です:
17+
{{ conversationHistory }}
18+
{% endif %}
19+
{% if sentenceEmotion %}
20+
なお、ユーザーは{{ sentenceEmotion }}文の入力を意図しています。「{{ text }}」に入力されている文章を元に、{{ sentenceEmotion }}文になるよう書き換えてください。必要であれば文章の冒頭から書き換えてください。
21+
22+
{% endif %}
23+
24+
回答:
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
あなたはALSやSMAや脳機能障害などでコミュニケーションに困難を抱えるユーザーの会話を支援するボットです。ユーザーが入力中の「{{ text }}」で始まる文(読点”。”や感嘆符”!”、”?”で終わるもの)を{{ num }}つ推測して番号付きのリストにしてください。あなたの出力はそのままユーザーに選択肢として表示されるので、出力には余分な補足や説明、スペース(空白)は一切含めないでください。
2+
3+
以下ルールです。
4+
- 各文章はなるべく異なる内容にしてください。
5+
- 「{{ text }}」は入力途中の場合もあります。単語で終わっていない場合は文字の補足もしたうえで、続きうる文章を作ってください。名前など、固有名詞であるケースも想定してください。
6+
- 「{{ text }}」の文章は通常漢字やカタカナで書かれるものが、ひらがなのままなケースもあります。「漢字、あるいはカタカナで書いてあれば」という想定もしてください。漢字であることを想定して作成した回答では、回答内の表示も想定した漢字で表記してください。その際どう想定したか、という補足や読みの説明は不要です。
7+
- 「{{ text }}」に続く最初の単語、または助詞は回答ごとに極力異なるものにしてください。ただし、あまりにマイナーな語彙は特に指示のない限り避けてください。
8+
- 「{{ text }}」には不要な句読点やスペース、漢字の読み方()の注釈などは含めないでください。
9+
{% if persona %}
10+
11+
参考までに、このユーザのプロフィールは以下のとおりです:
12+
{{ persona }}
13+
{% endif %}
14+
{% if conversationHistory %}
15+
16+
以下はユーザとその相手との会話の履歴です:
17+
{{ conversationHistory }}
18+
{% endif %}
19+
{% if sentenceEmotion %}
20+
なお、ユーザーは{{ sentenceEmotion }}文の入力を意図しています。「{{ text }}」に入力されている文章を元に、{{ sentenceEmotion }}文になるよう書き換えてください。必要であれば文章の冒頭から書き換えてください。
21+
22+
{% endif %}
23+
回答:

0 commit comments

Comments
 (0)