23 lines
1.7 KiB
TypeScript
23 lines
1.7 KiB
TypeScript
export type CodingRecoveryAction = 'login' | 'continue' | 'check-work' | 'refresh' | 'settings' | 'account';
|
|
|
|
/** Product copy is intentionally independent of raw provider/tool diagnostics. */
|
|
export function codingRecovery(errorCode?: string, work = false) {
|
|
if (errorCode === 'CODING_PROVIDER_AUTH_REQUIRED' || errorCode === 'AUTH_INVALID') {
|
|
return { action: 'login' as const, label: '登录并继续', message: '登录已失效,重新登录后就能接着完成这一步。' };
|
|
}
|
|
if (errorCode === 'CODING_PROVIDER_QUOTA_EXHAUSTED') {
|
|
return { action: 'account' as const, label: '查看点数', message: '点数暂时不够了,可以请家长帮忙补充后再继续。' };
|
|
}
|
|
if (errorCode === 'CODING_MODEL_UNAVAILABLE' || errorCode === 'CODING_MIGRATION_MODEL_REQUIRED') {
|
|
return { action: 'settings' as const, label: '选择可用模型', message: '还需要选择一个可用模型,选好后就能继续。' };
|
|
}
|
|
if (errorCode === 'CODING_REQUEST_UNCERTAIN') {
|
|
return { action: 'refresh' as const, label: '查看最新进展', message: '还没有收到完成消息,先查看进展,避免重复操作。' };
|
|
}
|
|
return work
|
|
? { action: 'check-work' as const, label: '帮我检查并打开', message: '作品还没有打开,我可以检查启动情况,再帮你打开。' }
|
|
: { action: 'continue' as const, label: '帮我继续', message: '这一步还没完成。可以让我检查已有进度,再接着做。' };
|
|
}
|
|
|
|
export const CONTINUE_CODING_PROMPT = '请检查上一次未完成的操作和当前项目的实际进度,再接着完成。已完成的步骤不要重复执行;如果缺少必要信息,直接告诉我需要补充什么。';
|