Skip to content

Commit

Permalink
chore: comment context history
Browse files Browse the repository at this point in the history
  • Loading branch information
Dogtiti committed Nov 9, 2024
1 parent d33e772 commit 4629b39
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions app/components/realtime-chat/realtime-chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 4629b39

Please sign in to comment.