forked from React-Group/interstellar_ai
Compare commits
No commits in common. "939cdd4497698e62799c9aff3a5fba803fa203e6" and "953ec7d06173679696c1934a714b2b55ca67f655" have entirely different histories.
939cdd4497
...
953ec7d061
1 changed files with 28 additions and 0 deletions
28
app/backend/ChatHistory.ts
Normal file
28
app/backend/ChatHistory.ts
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
|
||||||
|
// type Message = {
|
||||||
|
// role: string;
|
||||||
|
// content:string
|
||||||
|
// }
|
||||||
|
|
||||||
|
// type Chat = {
|
||||||
|
// name: string;
|
||||||
|
// messages: Message[];
|
||||||
|
// timestamp: number;
|
||||||
|
// };
|
||||||
|
|
||||||
|
// export function addMessageToHistory(index: number, chat: Chat): void {
|
||||||
|
// if (index >= 0 && index < chatHistory.length) {
|
||||||
|
// chatHistory[index] = chat;
|
||||||
|
// chatHistory.sort((a, b) => b.timestamp - a.timestamp)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// export function removeMessageFromHistory(timestamp: number): void {
|
||||||
|
// const index = chatHistory.findIndex((msg) => msg.timestamp === timestamp);
|
||||||
|
// if (index > -1) {
|
||||||
|
// chatHistory.splice(index, 1);
|
||||||
|
// console.log(`Removed message with timestamp: ${timestamp}`);
|
||||||
|
// } else {
|
||||||
|
// console.log(`Message not found with timestamp: ${timestamp}`);
|
||||||
|
// }
|
||||||
|
// }
|
Loading…
Reference in a new issue