interstellar_ai/app/backend/ChatHistory.ts

29 lines
813 B
TypeScript
Raw Normal View History

2024-10-07 16:41:31 +02:00
2024-10-08 12:56:28 +02:00
// type Message = {
// role: string;
// content:string
// }
2024-10-07 16:41:31 +02:00
2024-10-08 12:56:28 +02:00
// type Chat = {
// name: string;
// messages: Message[];
// timestamp: number;
// };
2024-10-01 10:50:19 +02:00
2024-10-08 12:56:28 +02:00
// 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)
// }
// }
2024-10-01 10:50:19 +02:00
2024-10-08 12:56:28 +02:00
// 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}`);
// }
// }