diff --git a/admin/constants/ollama.ts b/admin/constants/ollama.ts index d004a50..54d2ea7 100644 --- a/admin/constants/ollama.ts +++ b/admin/constants/ollama.ts @@ -62,8 +62,6 @@ export const FALLBACK_RECOMMENDED_OLLAMA_MODELS: NomadOllamaModel[] = [ }, ] -export const DEFAULT_QUERY_REWRITE_MODEL = 'qwen2.5:3b' // default to qwen2.5 for query rewriting with good balance of text task performance and resource usage - export const EMBEDDING_MODEL_NAME = 'nomic-embed-text:v1.5' /** diff --git a/admin/inertia/components/chat/ChatInterface.tsx b/admin/inertia/components/chat/ChatInterface.tsx index e2c021a..814b3a1 100644 --- a/admin/inertia/components/chat/ChatInterface.tsx +++ b/admin/inertia/components/chat/ChatInterface.tsx @@ -5,10 +5,6 @@ import { ChatMessage } from '../../../types/chat' import ChatMessageBubble from './ChatMessageBubble' import ChatAssistantAvatar from './ChatAssistantAvatar' import BouncingDots from '../BouncingDots' -import StyledModal from '../StyledModal' -import api from '~/lib/api' -import { DEFAULT_QUERY_REWRITE_MODEL } from '../../../constants/ollama' -import { useNotifications } from '~/context/NotificationContext' import { usePage } from '@inertiajs/react' interface ChatInterfaceProps { @@ -28,29 +24,12 @@ export default function ChatInterface({ chatSuggestions = [], chatSuggestionsEnabled = false, chatSuggestionsLoading = false, - rewriteModelAvailable = false, }: ChatInterfaceProps) { const { aiAssistantName } = usePage<{ aiAssistantName: string }>().props - const { addNotification } = useNotifications() const [input, setInput] = useState('') - const [downloadDialogOpen, setDownloadDialogOpen] = useState(false) - const [isDownloading, setIsDownloading] = useState(false) const messagesEndRef = useRef(null) const textareaRef = useRef(null) - const handleDownloadModel = async () => { - setIsDownloading(true) - try { - await api.downloadModel(DEFAULT_QUERY_REWRITE_MODEL) - addNotification({ type: 'success', message: 'Model download queued' }) - } catch (error) { - addNotification({ type: 'error', message: 'Failed to queue model download' }) - } finally { - setIsDownloading(false) - setDownloadDialogOpen(false) - } - } - const scrollToBottom = () => { messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' }) } @@ -192,38 +171,6 @@ export default function ChatInterface({ )} - {!rewriteModelAvailable && ( -
- The {DEFAULT_QUERY_REWRITE_MODEL} model is not installed. Consider{' '} - {' '} - for improved retrieval-augmented generation (RAG) performance. -
- )} - setDownloadDialogOpen(false)} - onClose={() => setDownloadDialogOpen(false)} - > -

- This will dispatch a background download job for{' '} - {DEFAULT_QUERY_REWRITE_MODEL} and may - take some time to complete. The model will be used to rewrite queries for improved RAG - retrieval performance. Note that download is only supported when using Ollama. If using - an OpenAI API interface, please download the model with that software. -

-
) diff --git a/admin/inertia/components/chat/index.tsx b/admin/inertia/components/chat/index.tsx index 91f864d..e1f0585 100644 --- a/admin/inertia/components/chat/index.tsx +++ b/admin/inertia/components/chat/index.tsx @@ -1,4 +1,4 @@ -import { useState, useCallback, useEffect, useRef, useMemo } from 'react' +import { useState, useCallback, useEffect, useRef } from 'react' import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query' import ChatSidebar from './ChatSidebar' import ChatInterface from './ChatInterface' @@ -10,7 +10,6 @@ import { useModals } from '~/context/ModalContext' import { ChatMessage } from '../../../types/chat' import classNames from '~/lib/classNames' import { IconMenu2, IconX } from '@tabler/icons-react' -import { DEFAULT_QUERY_REWRITE_MODEL } from '../../../constants/ollama' import { useSystemSetting } from '~/hooks/useSystemSetting' import Switch from '~/components/inputs/Switch' import InfoTooltip from '~/components/InfoTooltip' @@ -133,7 +132,7 @@ export default function Chat({ try { const stored = localStorage.getItem(`nomad:thinking:${m.name}`) if (stored !== null) next[m.name] = stored === 'true' - } catch {} + } catch { } } setThinkingOverrides(next) }, [installedModels]) @@ -152,7 +151,7 @@ export default function Chat({ setThinkingOverrides((prev) => ({ ...prev, [model]: value })) try { localStorage.setItem(`nomad:thinking:${model}`, String(value)) - } catch {} + } catch { } }, []) const { data: chatSuggestions, isLoading: chatSuggestionsLoading } = useQuery({ @@ -166,10 +165,6 @@ export default function Chat({ refetchOnMount: false, }) - const rewriteModelAvailable = useMemo(() => { - return installedModels.some((model) => model.name === DEFAULT_QUERY_REWRITE_MODEL) - }, [installedModels]) - const deleteAllSessionsMutation = useMutation({ mutationFn: () => api.deleteAllChatSessions(), onSuccess: () => { @@ -449,13 +444,13 @@ export default function Chat({ prev.map((m) => m.id === assistantMsgId ? { - ...m, - content: m.content + chunkContent, - thinking: (m.thinking ?? '') + chunkThinking, - isStreaming: !done, - isThinking: isThinkingPhase, - thinkingDuration: thinkingDuration ?? undefined, - } + ...m, + content: m.content + chunkContent, + thinking: (m.thinking ?? '') + chunkThinking, + isStreaming: !done, + isThinking: isThinkingPhase, + thinkingDuration: thinkingDuration ?? undefined, + } : m ) ) @@ -586,24 +581,24 @@ export default function Chat({ )} {ragEnabled && ( -
- - -
- )} -
+
+ + +
+ )} +
@@ -641,21 +636,21 @@ export default function Chat({ />
{selectedModelSupportsThinking && ( -
- Thinking: - - setModelThinking(selectedModel, v)} - /> -
- )} - {isInModal && ( +
+ Thinking: + + setModelThinking(selectedModel, v)} + /> +
+ )} + {isInModal && (