Update dependencies and fix styling issues

This commit is contained in:
n4ze3m
2024-02-07 00:11:07 +05:30
parent a66d8a8418
commit 58966355c3
21 changed files with 1175 additions and 51 deletions

62
src/store/option.tsx Normal file
View File

@@ -0,0 +1,62 @@
import { create } from "zustand"
export type Message = {
isBot: boolean
name: string
message: string
sources: any[]
images?: string[]
}
export type ChatHistory = {
role: "user" | "assistant" | "system"
content: string,
image?: string
}[]
type State = {
messages: Message[]
setMessages: (messages: Message[]) => void
history: ChatHistory
setHistory: (history: ChatHistory) => void
streaming: boolean
setStreaming: (streaming: boolean) => void
isFirstMessage: boolean
setIsFirstMessage: (isFirstMessage: boolean) => void
historyId: string | null
setHistoryId: (history_id: string | null) => void
isLoading: boolean
setIsLoading: (isLoading: boolean) => void
isProcessing: boolean
setIsProcessing: (isProcessing: boolean) => void
selectedModel: string | null
setSelectedModel: (selectedModel: string) => void
chatMode: "normal" | "rag"
setChatMode: (chatMode: "normal" | "rag") => void
isEmbedding: boolean
setIsEmbedding: (isEmbedding: boolean) => void
}
export const useStoreMessageOption = create<State>((set) => ({
messages: [],
setMessages: (messages) => set({ messages }),
history: [],
setHistory: (history) => set({ history }),
streaming: true,
setStreaming: (streaming) => set({ streaming }),
isFirstMessage: true,
setIsFirstMessage: (isFirstMessage) => set({ isFirstMessage }),
historyId: null,
setHistoryId: (historyId) => set({ historyId }),
isLoading: false,
setIsLoading: (isLoading) => set({ isLoading }),
isProcessing: false,
setIsProcessing: (isProcessing) => set({ isProcessing }),
defaultSpeechToTextLanguage: "en-US",
selectedModel: null,
setSelectedModel: (selectedModel) => set({ selectedModel }),
chatMode: "normal",
setChatMode: (chatMode) => set({ chatMode }),
isEmbedding: false,
setIsEmbedding: (isEmbedding) => set({ isEmbedding }),
}))