feat(web): 聊天请求携带行为模式 mode(A3) — useChat 读当前 mode 经 REST 发送
- api.ts chatStream 新增可选 mode,空则不写键(后端回落chat) - useChat.ts 发送时带上 useModeStore 当前 mode,使非chat模式消息在Web端真正落库 - 修正 docblock(移除虚构的WS chat回退描述)
This commit is contained in:
1 parent
b686d5fec8
commit
747b9ad414
2 files changed
+19
-10
No files matched your search
@@ -248,15 +248,24 @@ export function chatSync(
|
||||
* `image` (a base64 data: URI or URL) is attached for the vision path; the
|
||||
* gateway's chat body currently has no image field, so an unconfigured backend
|
||||
* simply ignores it. `deviceId` mirrors the client's per-browser id onto the
|
||||
* persisted message (design/16 §4.5). */
|
||||
* persisted message (design/16 §4.5). `mode` is the behavior mode this turn is
|
||||
* sent in (design/01 §3); omitted when empty so the backend falls back to chat. */
|
||||
export function chatStream(
|
||||
sessionId: string,
|
||||
text: string,
|
||||
image?: string
|
||||
image?: string,
|
||||
mode?: Mode
|
||||
): Promise<{ stream: true }> {
|
||||
return request<{ stream: true }>("/chat", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ sessionId, text, image, stream: true, deviceId: getClientId() }),
|
||||
body: JSON.stringify({
|
||||
sessionId,
|
||||
text,
|
||||
image,
|
||||
stream: true,
|
||||
deviceId: getClientId(),
|
||||
...(mode ? { mode } : {}),
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user