mirror of
https://github.com/dataelement/bisheng.git
synced 2026-10-30 18:42:04 +08:00
Merge remote-tracking branch 'origin/feat/2.1.0' into feat/2.1.0
This commit is contained in:
@@ -110,7 +110,7 @@ export async function getChatHistoryApi(flowId: string, chatId: string, flowType
|
||||
return {
|
||||
...other,
|
||||
category: _category,
|
||||
chatKey: typeof message === 'string' ? undefined : Object.keys(message)[0],
|
||||
chatKey: Number(flowType) === 5 ? 'input' : (typeof message === 'string' ? undefined : Object.keys(message)[0]),
|
||||
end: true,
|
||||
files: _files,
|
||||
isSend: _isSend,
|
||||
|
||||
@@ -22,7 +22,9 @@ export default function ChatView({ data, v }) {
|
||||
<span className="text-sm">{data.name}</span>
|
||||
</div> */}
|
||||
<HeaderTitle conversation={{ title: data.name }} />
|
||||
<div className="min-h-0 flex-1 bg-[position:0_100%] bg-repeat-x bg-[length:10px_432px]" style={{ backgroundImage: `url(${__APP_ENV__.BASE_URL}/assets/points.png)` }}>
|
||||
<div className="min-h-0 flex-1 bg-[position:0_100%] bg-repeat-x bg-[length:10px_432px]"
|
||||
// style={{ backgroundImage: `url(${__APP_ENV__.BASE_URL}/assets/points.png)` }}
|
||||
>
|
||||
<div className="relative h-full max-w-[1200px] mx-auto">
|
||||
<ChatMessages useName={user?.username} logo={Logo} />
|
||||
<ChatInput v={v} />
|
||||
|
||||
@@ -144,7 +144,7 @@ export const SkillMethod = {
|
||||
}
|
||||
} else {
|
||||
if ((prevMessage
|
||||
&& prevMessage.message === newCurrentMessage.message
|
||||
&& prevMessage.message === newCurrentMessage.message && newCurrentMessage.end
|
||||
&& prevMessage.thought === newCurrentMessage.thought)
|
||||
|| cover) {
|
||||
const removedMsg = messages.pop()
|
||||
|
||||
@@ -36,8 +36,10 @@ export default function index() {
|
||||
const currentData = chats[cid]
|
||||
let error = ''
|
||||
|
||||
setChatId(cid!) // 切换会话
|
||||
|
||||
// 无缓存,从新加载
|
||||
if (currentData) return setChatId(cid!);
|
||||
if (currentData) return;
|
||||
|
||||
const numericType = Number(type);
|
||||
|
||||
@@ -111,7 +113,6 @@ export default function index() {
|
||||
}
|
||||
})
|
||||
|
||||
setChatId(cid!)
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -146,7 +146,7 @@ export default function useChatHelpers() {
|
||||
is_bot,
|
||||
extra,
|
||||
liked,
|
||||
message,
|
||||
message: msg,
|
||||
receiver,
|
||||
type,
|
||||
source,
|
||||
@@ -171,14 +171,14 @@ export default function useChatHelpers() {
|
||||
file_url: el.file_url || el.url
|
||||
})),
|
||||
is_bot,
|
||||
message,
|
||||
message: msg,
|
||||
receiver,
|
||||
source,
|
||||
user_id,
|
||||
liked: !!liked,
|
||||
end: type === "over",
|
||||
sender: "",
|
||||
node_id: message?.node_id || "",
|
||||
node_id: msg?.node_id || "",
|
||||
create_time: formatDate(new Date(), "yyyy-MM-ddTHH:mm:ss"),
|
||||
extra,
|
||||
reasoning_log,
|
||||
|
||||
@@ -56,6 +56,22 @@ export const useWebSocket = (helpers) => {
|
||||
data: { ...flow, ...data },
|
||||
}
|
||||
ws?.send(JSON.stringify(msg))
|
||||
} else {
|
||||
const msg = {
|
||||
chatHistory: [],
|
||||
chat_id: helpers.chatId,
|
||||
flow_id: helpers.flow.id,
|
||||
inputs: {
|
||||
data: {
|
||||
id: helpers.flow.id,
|
||||
chatId: helpers.chatId,
|
||||
type: helpers.flow.flow_type,
|
||||
}
|
||||
},
|
||||
name: helpers.flow.name,
|
||||
description: helpers.flow.description
|
||||
}
|
||||
ws?.send(JSON.stringify(msg))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user