Spaces:
Running
Running
| export function realtimePayloadErrorMessage(payload) { | |
| return String(payload?.error?.message || payload?.error || payload?.message || ''); | |
| } | |
| export function isBenignRealtimeCancelError(payload) { | |
| return /Conversation has none active response/i.test(realtimePayloadErrorMessage(payload)); | |
| } | |
| export function normalizeVoiceCommandText(value) { | |
| return String(value || '') | |
| .toLowerCase() | |
| .replace(/[\s,。!?、,.!?;;::"'“”‘’()()【】\[\]<>《》]/g, ''); | |
| } | |
| export function isVoiceHandoffCommand(value) { | |
| const text = normalizeVoiceCommandText(value); | |
| if (!text) { | |
| return false; | |
| } | |
| const wantsSummary = /总结|整理|归纳|汇总|梳理|提炼|概括|组织|形成任务|变成任务|整理成任务/.test(text); | |
| const wantsHandoff = /交给|发给|发送给|提交给|提交|让|叫|拿给|丢给|转给|传给|给/.test(text); | |
| const wantsAction = /执行|处理|做|改|实现|修|查|跑|操作|落实|开始干/.test(text); | |
| const mentionsExecutor = | |
| /codex|code[x叉]?|代码|扣德克斯|扣得克斯|扣的克斯|扣得|扣德|科德克斯|科得克斯|寇德克斯|口德克斯|口得克斯|助手|后台|你/.test(text); | |
| if (mentionsExecutor && ((wantsSummary && wantsHandoff) || (wantsSummary && wantsAction) || (wantsHandoff && wantsAction))) { | |
| return true; | |
| } | |
| if (wantsSummary && wantsHandoff) { | |
| return true; | |
| } | |
| if (/交给codex|发给codex|提交给codex|让codex|交给代码|发给代码|提交给代码|让代码/.test(text)) { | |
| return true; | |
| } | |
| return false; | |
| } | |