Merge branch 'ji' into master (操作日志 Y-Log 上报)
# Conflicts: # CLAUDE.md
This commit is contained in:
commit
053d3e300e
35 files changed
+1182
-125
No files matched your search
@@ -53,6 +53,7 @@ import { useThreadStream } from "@/core/threads/hooks";
|
||||
import { useLayoutMode } from "@/core/system-settings/hooks";
|
||||
import { useRouteBase } from "@/core/route-base";
|
||||
import { textOfMessage } from "@/core/threads/utils";
|
||||
import { OptType, writeYLog } from "@/core/log/y-log";
|
||||
import { env } from "@/env";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
@@ -187,6 +188,21 @@ export default function ChatPage() {
|
||||
);
|
||||
},
|
||||
onFinish: (state) => {
|
||||
// 操作日志(Y-Log):问答完成(成功)后,用最终汇总文本上报一条。
|
||||
try {
|
||||
const msgs = state.messages ?? [];
|
||||
const lastAi = [...msgs].reverse().find((m) => (m as { type?: string }).type === "ai");
|
||||
const lastHuman = [...msgs].reverse().find((m) => (m as { type?: string }).type === "human");
|
||||
writeYLog({
|
||||
optType: OptType.other,
|
||||
optDetail: "B1-CM助手-专家代理问答",
|
||||
url: `/api/threads/${threadId ?? ""}/runs/stream`,
|
||||
reqParam: { agent_id: selectedAgentId, question: lastHuman ? textOfMessage(lastHuman) : "" },
|
||||
returnParam: { data: lastAi ? textOfMessage(lastAi) : "" },
|
||||
});
|
||||
} catch {
|
||||
/* 上报绝不影响问答 */
|
||||
}
|
||||
if (document.hidden || !document.hasFocus()) {
|
||||
let body = "Conversation finished";
|
||||
const lastMessage = state.messages.at(-1);
|
||||
|
||||
Reference in new issue
Block a user