修复访客端未使用 emitTyping 导致前端构建失败
删除已被 input_draft 替代的死代码,通过 tsc 严格未使用检查。
This commit is contained in:
@@ -720,15 +720,6 @@ const VisitorChat = ({
|
|||||||
}))
|
}))
|
||||||
}, [sessionId, sessionEnded])
|
}, [sessionId, sessionEnded])
|
||||||
|
|
||||||
const emitTyping = () => {
|
|
||||||
// 兼容:无正文的旧 typing;正文走 emitInputDraft
|
|
||||||
if (!sessionId || sessionEnded || !agentsOnline) return
|
|
||||||
const now = Date.now()
|
|
||||||
if (now - lastTypingAt.current < 1200 || socketRef.current?.readyState !== WebSocket.OPEN) return
|
|
||||||
lastTypingAt.current = now
|
|
||||||
socketRef.current.send(JSON.stringify({ type: 'typing', session_id: sessionId }))
|
|
||||||
}
|
|
||||||
|
|
||||||
const postMessage = async (content: string, type: 'text' | 'image') => {
|
const postMessage = async (content: string, type: 'text' | 'image') => {
|
||||||
if (!sessionId || !visitorToken) throw new Error('会话未就绪')
|
if (!sessionId || !visitorToken) throw new Error('会话未就绪')
|
||||||
const res = await fetch('/api/widget/message', {
|
const res = await fetch('/api/widget/message', {
|
||||||
|
|||||||
Reference in New Issue
Block a user