feat: add semantic WeChat session actions
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
isTopicResetText,
|
||||
wantsDocxDownload,
|
||||
} from './patterns.mjs';
|
||||
import { WECHAT_SESSION_ACTION } from './session-action.mjs';
|
||||
|
||||
/**
|
||||
* @typedef {object} WechatPageGenerateIntent
|
||||
@@ -15,6 +16,7 @@ import {
|
||||
*
|
||||
* @typedef {object} WechatSessionResetIntent
|
||||
* @property {'session.reset'} kind
|
||||
* @property {string} sessionAction
|
||||
*
|
||||
* @typedef {object} WechatStatusProbeIntent
|
||||
* @property {'status.probe'} kind
|
||||
@@ -46,7 +48,9 @@ export function classifyWechatIntent(intent) {
|
||||
const text = String(intent?.agentText ?? intent?.displayText ?? '').trim();
|
||||
|
||||
if (msgType === 'text' || msgType === 'voice') {
|
||||
if (isTopicResetText(text)) return { kind: 'session.reset' };
|
||||
if (isTopicResetText(text)) {
|
||||
return { kind: 'session.reset', sessionAction: WECHAT_SESSION_ACTION.RESET };
|
||||
}
|
||||
if (STATUS_PROBE_PATTERN.test(text)) return { kind: 'status.probe' };
|
||||
if (GREETING_PATTERN.test(text.replace(/[!!。.\s]+$/g, ''))) return { kind: 'greeting' };
|
||||
if (CONNECTIVITY_TEST_PATTERN.test(text.replace(/[!!。.\s]+$/g, ''))) {
|
||||
|
||||
Reference in New Issue
Block a user