Skip to content

Commit e0587ac

Browse files
committed
fix: try to handle sonnet problem in translation prompt
1 parent 90aaa47 commit e0587ac

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/server/model/prompt/survey.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ Please help me translate those file to '${language}', direct give me json format
169169
data.reduce((prev, curr) => {
170170
return {
171171
...prev,
172-
[curr.id]: curr.content,
172+
[curr.id]: curr.content.replace(/"/g, "'"), // replace user input double quotes to single quotes to avoid json parse error
173173
};
174174
}, {})
175175
),

src/server/mq/worker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ async function runSurveyAITranslationWorker(msg: string) {
361361
id: item.id,
362362
content: item.payload[payloadContentField] ?? '',
363363
})),
364-
100 // use 100 as group size default
364+
40 // use 40 rather than 100 to avoid sonnet attention mechanism
365365
);
366366

367367
logger.info('Process run survey AI translation, groups', groups.length);

0 commit comments

Comments
 (0)