@@ -115,15 +154,19 @@ export default function MessageBs({ data, onUnlike = () => { }, flow_type, onSou
} */}
- {data.message.toString() && data.message.toString().includes('```chart') &&
}
- {data.message.toString() && !data.message.toString().includes('```chart') &&
- {mkdown}
+ {(data.message.toString() || (data.reasoning_content && data.reasoning_content.toString())) && data.message.toString().includes('```chart') &&
}
+ {(data.message.toString() || (data.reasoning_content && data.reasoning_content.toString())) && !data.message.toString().includes('```chart') &&
+ {(data.reasoning_content && data.reasoning_content.toString()) &&
+
{setShenduOff(!shenduOff)}}>深度思考
+ {shenduOff &&
{mkdownReasoning}
}
+
}
+
{mkdown}
{/* @user */}
{data.receiver &&
@ {data.receiver.user_name}
}
{/* 光标 */}
{/* {data.message.toString() && !data.end &&
} */}
}
- {!data.message.toString() &&
}
+ {(!data.message.toString() && !data.reasoning_content.toString()) &&
}
{/* 赞 踩 */}
{!!data.id && data.end &&
;
diff --git a/src/components/bs-comp/chatComponent/messageStore.ts b/src/components/bs-comp/chatComponent/messageStore.ts
index 2b13410..f15ffad 100644
--- a/src/components/bs-comp/chatComponent/messageStore.ts
+++ b/src/components/bs-comp/chatComponent/messageStore.ts
@@ -50,9 +50,10 @@ const handleHistoryMsg = (data: any[]): ChatMessageType[] => {
.replace(/'/g, '"'); // 将单引号替换为双引号
return data.map(item => {
// let count = 0
- let { message, files, is_bot, intermediate_steps, ...other } = item
+ let { message,reasoning_content, files, is_bot, intermediate_steps, ...other } = item
try {
message = message && message[0] === '{' ? JSON.parse(message) : message || ''
+ reasoning_content = reasoning_content && reasoning_content[0] === '{' ? JSON.parse(reasoning_content) : reasoning_content || ''
} catch (e) {
// 未考虑的情况暂不处理
console.error('消息 to JSON error :>> ', e);
@@ -64,6 +65,7 @@ const handleHistoryMsg = (data: any[]): ChatMessageType[] => {
files: files ? JSON.parse(files) : [],
isSend: !is_bot,
message,
+ reasoning_content,
thought: intermediate_steps,
noAccess: true
}
@@ -134,6 +136,7 @@ export const useMessageStore = create
((set, get) => ({
newChat.push({
isSend: false,
message: runLogsTypes.includes(data.category) ? JSON.parse(data.message) : '',
+ reasoning_content: runLogsTypes.includes(data.category) ? JSON.parse(data.reasoning_content) : '',
chatKey: '',
thought: data.intermediate_steps || '',
category: data.category || '',
@@ -165,6 +168,7 @@ export const useMessageStore = create((set, get) => ({
...wsdata,
id: isRunLog ? wsdata.extra : wsdata.messageId, // 每条消息必唯一
message: isRunLog ? JSON.parse(wsdata.message) : currentMessage.message + wsdata.message,
+ reasoning_content: isRunLog ? JSON.parse(wsdata.reasoning_content) : currentMessage.reasoning_content + wsdata.reasoning_content,
thought: currentMessage.thought + (wsdata.thought ? `${wsdata.thought}\n` : ''),
files: wsdata.files || null,
category: wsdata.category || '',
@@ -243,6 +247,7 @@ const bsMsgItem = {
id: Math.random() * 1000000,
isSend: false,
message: '',
+ reasoning_content: '',
chatKey: '',
thought: '',
category: '',
diff --git a/src/style/zk.scss b/src/style/zk.scss
index 2ba65db..5b795f9 100644
--- a/src/style/zk.scss
+++ b/src/style/zk.scss
@@ -4214,4 +4214,23 @@
}
}
}
+ }
+ .shenduBtn{
+ width: 100px;
+ padding: 7px 14px;
+ background: rgba(255, 255, 255, 0.05);
+ display: flex;
+ align-items: center;
+ border-radius: 10px;
+ cursor: pointer;
+ color: #999999;
+ }
+ .transform180{
+ transform: rotate(180deg);
+ }
+ .shenduText{
+ color: #999999;
+ margin-top: 10px;
+ line-height: 26px;
+ margin-bottom: 10px;
}
\ No newline at end of file
diff --git a/src/types/chat/index.ts b/src/types/chat/index.ts
index bc9fcf9..5f7689b 100644
--- a/src/types/chat/index.ts
+++ b/src/types/chat/index.ts
@@ -3,6 +3,7 @@ import { FlowType } from "../flow";
export type ChatType = { flow: FlowType; reactFlowInstance: ReactFlowInstance };
export type ChatMessageType = {
+ reasoning_content: string | Object;
message: string | Object;
template?: string;
isSend: boolean;