()
| 160 | } |
| 161 | |
| 162 | const handleClearConversation = () => { |
| 163 | // 如果正在生成回复,先停止所有进行中的操作 |
| 164 | if (isStreaming || isExtractingInfo || isUpdatingMap) { |
| 165 | // 取消正在进行的请求 |
| 166 | if (abortControllerRef.current) { |
| 167 | abortControllerRef.current.abort() |
| 168 | abortControllerRef.current = null |
| 169 | } |
| 170 | |
| 171 | setIsStreaming(false) |
| 172 | setIsExtractingInfo(false) |
| 173 | setIsUpdatingMap(false) |
| 174 | |
| 175 | // 添加一条消息提示用户响应已被中断 |
| 176 | // toast({ |
| 177 | // title: "已中断", |
| 178 | // description: "响应生成已被取消", |
| 179 | // }) |
| 180 | } |
| 181 | |
| 182 | // 清空消息和地图标记 |
| 183 | setMessages([]) |
| 184 | setMarkers([]) |
| 185 | setTaskType(TASK_TYPES.LOCATION_LIST) // 重置任务类型 |
| 186 | } |
| 187 | |
| 188 | // 处理生成回复的逻辑(从handleSubmit中提取出来的核心部分) |
| 189 | const handleGenerateResponse = async (queryText: string, userMessageId: string, assistantMessageId: string) => { |
nothing calls this directly
no outgoing calls
no test coverage detected