mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2024-11-21 03:20:57 +08:00
chore: comment context history
This commit is contained in:
parent
d33e772fa5
commit
4629b39c29
@ -85,27 +85,28 @@ export function RealtimeChat({
|
||||
startResponseListener();
|
||||
|
||||
setIsConnected(true);
|
||||
try {
|
||||
const recentMessages = chatStore.getMessagesWithMemory();
|
||||
for (const message of recentMessages) {
|
||||
const { role, content } = message;
|
||||
if (typeof content === "string") {
|
||||
await clientRef.current.sendItem({
|
||||
type: "message",
|
||||
role: role as any,
|
||||
content: [
|
||||
{
|
||||
type: (role === "assistant" ? "text" : "input_text") as any,
|
||||
text: content as string,
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
}
|
||||
// await clientRef.current.generateResponse();
|
||||
} catch (error) {
|
||||
console.error("Set message failed:", error);
|
||||
}
|
||||
// TODO
|
||||
// try {
|
||||
// const recentMessages = chatStore.getMessagesWithMemory();
|
||||
// for (const message of recentMessages) {
|
||||
// const { role, content } = message;
|
||||
// if (typeof content === "string") {
|
||||
// await clientRef.current.sendItem({
|
||||
// type: "message",
|
||||
// role: role as any,
|
||||
// content: [
|
||||
// {
|
||||
// type: (role === "assistant" ? "text" : "input_text") as any,
|
||||
// text: content as string,
|
||||
// },
|
||||
// ],
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// // await clientRef.current.generateResponse();
|
||||
// } catch (error) {
|
||||
// console.error("Set message failed:", error);
|
||||
// }
|
||||
} catch (error) {
|
||||
console.error("Connection failed:", error);
|
||||
setStatus("Connection failed");
|
||||
|
Loading…
Reference in New Issue
Block a user