Ask which language the content is written in
The Instruction agent now confirms the output language before the plan is
ready: Bahasa Indonesia, English or 中文, the languages the engine writes
in. It can also be named in the instruction ("pakai bahasa Inggris"), is
read from short replies, and can be changed in the plan. Research alone
is not asked about.
The engine's content production has no language field, so the choice
goes into the agent's instructions; video schedules also set
video_options.language. ruleOf reads it back, so editing a topic keeps
it. The audio player recognises Chinese scripts and uses a zh-CN voice.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,7 +7,8 @@ const rules = (s: AgentState) => s.items.map(i => i.rule)
|
||||
|
||||
describe('instruction agent', () => {
|
||||
it('needs no question when the instruction is complete', () => {
|
||||
const s = say('make 2 summaries per day about leadership')
|
||||
const s = say('make 2 summaries per day about leadership in english')
|
||||
expect(s.language).toBe('English')
|
||||
expect(nextQuestion(s)).toBeNull()
|
||||
expect(respond(s, 'yes').approve).toBe(true)
|
||||
})
|
||||
@@ -19,7 +20,7 @@ describe('instruction agent', () => {
|
||||
})
|
||||
|
||||
it('stops asking for a topic once the whole Brain is chosen', () => {
|
||||
expect(nextQuestion(say('make 3 quizzes per week', t('agent.optWholeBrain')))).toBeNull()
|
||||
expect(nextQuestion(say('make 3 quizzes per week', t('agent.optWholeBrain')))?.type).toBe('language')
|
||||
})
|
||||
|
||||
it('asks about a video count that has no cadence', () => {
|
||||
@@ -39,7 +40,25 @@ describe('instruction agent', () => {
|
||||
it('asks about parts it did not understand, and can skip them', () => {
|
||||
const s = say('2 summaries per day about sales. hello there')
|
||||
expect(nextQuestion(s)).toMatchObject({ type: 'unknown', text: 'hello there' })
|
||||
expect(nextQuestion(say('2 summaries per day about sales. hello there', 'skip'))).toBeNull()
|
||||
expect(nextQuestion(say('2 summaries per day about sales. hello there', 'skip'))?.type).toBe('language')
|
||||
})
|
||||
|
||||
it('asks which language the content is written in', () => {
|
||||
expect(nextQuestion(say('3 quizzes per week about sales'))?.type).toBe('language')
|
||||
expect(say('3 quizzes per week about sales', 'mandarin').language).toBe('中文')
|
||||
expect(say('3 quizzes per week about sales', 'indo').language).toBe('Bahasa Indonesia')
|
||||
expect(nextQuestion(say('3 quizzes per week about sales', '中文 (Mandarin)'))).toBeNull()
|
||||
})
|
||||
|
||||
it('reads the language from the instruction without leaving it in the topic', () => {
|
||||
const s = say('bikin 3 kuis per minggu soal negosiasi pakai bahasa inggris')
|
||||
expect(s.language).toBe('English')
|
||||
expect(rules(s)[0]).toMatchObject({ topic: 'negosiasi' })
|
||||
expect(s.unknown).toEqual([])
|
||||
})
|
||||
|
||||
it('does not ask about the language for research alone', () => {
|
||||
expect(nextQuestion(say('research every day about sales in China'))).toBeNull()
|
||||
})
|
||||
|
||||
it('treats a reply with a frequency as a new request', () => {
|
||||
|
||||
Reference in New Issue
Block a user