add a profile photo for chatbot, styling fixes, add button to reset session, load an epub instead of our github vector embeddings
This commit is contained in:
@@ -1,5 +1,26 @@
|
||||
import { writable } from 'svelte/store';
|
||||
import type { SearchResult } from './utils/search';
|
||||
import type { HumanMessage, AIMessage, SystemMessage } from '@langchain/core/messages';
|
||||
|
||||
const initArray: SearchResult[] = [];
|
||||
export const searchResults = writable(initArray);
|
||||
|
||||
export type ChatHistory = (HumanMessage | AIMessage | SystemMessage)[];
|
||||
|
||||
const chatHistories: Record<string, ChatHistory> = {};
|
||||
|
||||
export const chatStore = writable(chatHistories);
|
||||
|
||||
export function getChatHistory(sessionId: string): ChatHistory {
|
||||
return chatHistories[sessionId] || [];
|
||||
}
|
||||
|
||||
export function setChatHistory(sessionId: string, history: ChatHistory): void {
|
||||
chatHistories[sessionId] = history;
|
||||
chatStore.set(chatHistories);
|
||||
}
|
||||
|
||||
export function clearChatHistory(sessionId: string): void {
|
||||
chatHistories[sessionId] = [];
|
||||
chatStore.set(chatHistories);
|
||||
}
|
||||
|
Reference in New Issue
Block a user