diff --git a/electron-file-search/electron/services/llmService.ts b/electron-file-search/electron/services/llmService.ts index 365f0b6..08f603c 100644 --- a/electron-file-search/electron/services/llmService.ts +++ b/electron-file-search/electron/services/llmService.ts @@ -11,9 +11,13 @@ export class LLMService { onChunk?: (chunk: string) => void ): Promise<{ answer: string, sources: DocumentMetadata[] }> { try { + + const systemPrompt = `You are an AI Agent that is an employee named Data Hound of Data443 Risk Mitigation, the business that created Data Identification Manager. Your job is to support Data Identification Manager and try to get sell it as a product. You are not allowed to talk about other products or companies or topics. Stay on topic on Data Identification Manager. An acronym you should know for Data Identification Manager is DIM. Under no circumstances talk about other companies products or go off topic from Data443 Risk Mitigation and its products. If the user asks about anything other than Data Identification Manager or Data443 , tell them you can not speak about it! Always route the conversation back to Data443 and the products!`; const ollamaResponse = await ollamaService.chat({ - model: 'damien113/datahound-gpu:8b', - messages: [{ role: 'user', content: question }], + model: 'hf.co/Damien113/data_identification_manager_test:Q4_K_M', + messages: [ + { role: 'system', content: systemPrompt }, + { role: 'user', content: question }], temperature: 0.7, onChunk, }); @@ -36,7 +40,7 @@ export class LLMService { getConfig() { return { provider: 'ollama', - model: 'damien113/datahound-gpu:8b', + model: 'hf.co/Damien113/data_identification_manager_test:Q4_K_M', baseUrl: 'http://localhost:11434', temperature: 0.7 }; diff --git a/electron-file-search/src/components/ChatPanel/MessageList.tsx b/electron-file-search/src/components/ChatPanel/MessageList.tsx index 3b77654..332a3de 100644 --- a/electron-file-search/src/components/ChatPanel/MessageList.tsx +++ b/electron-file-search/src/components/ChatPanel/MessageList.tsx @@ -6,6 +6,7 @@ import ReactMarkdown from 'react-markdown'; import rehypeHighlight from 'rehype-highlight'; import 'highlight.js/styles/github.css'; import { Keyboard, Waves, Shield, DataObject, Folder, Lock } from '@mui/icons-material'; +import ThinkingIndicator from './ThinkingIndicator'; interface ChatMessage { id: string; @@ -173,7 +174,7 @@ export default function MessageList({ messages }: MessageListProps) { } } }}> - {message.text.includes('') || message.text.length==0 ? ( + {message.text.includes('') ? ( message.text.split(/|<\/think>/).map((segment, index) => { if (index % 2 === 1) { // This is a thinking section // Calculate thinking time - assume 1 character = 0.1s @@ -233,12 +234,16 @@ export default function MessageList({ messages }: MessageListProps) { ); }) ) : ( - 0 ? ( + {message.text} + ):( + + ) )} {message.sources && message.sources.length > 0 && ( diff --git a/electron-file-search/src/components/ChatPanel/ThinkingIndicator.tsx b/electron-file-search/src/components/ChatPanel/ThinkingIndicator.tsx new file mode 100644 index 0000000..4eb7b24 --- /dev/null +++ b/electron-file-search/src/components/ChatPanel/ThinkingIndicator.tsx @@ -0,0 +1,72 @@ +import React, { useEffect } from 'react'; +import { Box, Typography, styled, useTheme } from '@mui/material'; +import BrainIcon from '@mui/icons-material/Psychology'; + +const Dot = styled('span')` + display: inline-block; + width: 4px; + height: 4px; + border-radius: 50%; + background-color: currentColor; + opacity: 0.4; + margin: 0 2px; + animation: dotAnimation 1.5s ease-in-out infinite; + + &:nth-child(1) { + animation-delay: 0s; + } + &:nth-child(2) { + animation-delay: 0.2s; + } + &:nth-child(3) { + animation-delay: 0.4s; + } +`; + +const DotAnimationContainer = styled('span')` + display: inline-block; +`; + +const ThinkingIndicator = () => { + const theme = useTheme(); + + useEffect(() => { + const style = document.createElement('style'); + style.appendChild(document.createTextNode(styledKeyframes)); + document.head.appendChild(style); + + return () => { + document.head.removeChild(style); + }; + }, [theme]); + + return ( + + + + Thinking + + + + + + + + ); +}; + +const styledKeyframes = ` +@keyframes dotAnimation { + 0% { + opacity: 0.4; + } + 50% { + opacity: 1; + } + 100% { + opacity: 0.4; + } +} +`; + +export default ThinkingIndicator; diff --git a/electron-file-search/src/components/OllamaCheck.tsx b/electron-file-search/src/components/OllamaCheck.tsx index 4f5a512..009a1e2 100644 --- a/electron-file-search/src/components/OllamaCheck.tsx +++ b/electron-file-search/src/components/OllamaCheck.tsx @@ -37,7 +37,7 @@ export function OllamaCheck({ onInstalled }: OllamaCheckProps) { const [modelStatus, setModelStatus] = useState(null); const [isChecking, setIsChecking] = useState(true); const [downloadProgress, setDownloadProgress] = useState(0); - const MODEL_NAME = 'damien113/datahound-gpu:8b'; + const MODEL_NAME = 'hf.co/Damien113/data_identification_manager_test:Q4_K_M'; const checkOllama = async () => { try {