diff --git a/src/App.tsx b/src/App.tsx index e0d30da..b43c824 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,5 +1,5 @@ -import React, { useState, useEffect } from 'react'; -import { BrowserRouter as Router, Routes, Route, Navigate, useLocation } from 'react-router-dom'; +import { useState, useEffect } from 'react'; +import { BrowserRouter as Router, Routes, Route, Navigate } from 'react-router-dom'; import HomeView from './views/HomeView'; import ServiceView from './views/ServiceView'; import LoginView from './views/LoginView'; @@ -14,7 +14,7 @@ function AppContent() { const [isSettingsOpen, setIsSettingsOpen] = useState(false); const [isChatOpen, setIsChatOpen] = useState(false); const { user, logout } = useAuth(); - const location = useLocation(); + // Gestion du thème const [theme, setTheme] = useState<'dark' | 'light'>( @@ -33,9 +33,7 @@ function AppContent() { return () => window.removeEventListener('analyze-log', handleOpenAI); }, []); - // Détection du service ID dans l'URL pour le contexte IA - const serviceIdMatch = location.pathname.match(/\/service\/(\d+)/); - const currentServiceId = serviceIdMatch ? parseInt(serviceIdMatch[1]) : null; + // Détection du service ID dans l'URL pour le contexte IA (omis car inutilisé) return (
diff --git a/src/components/AIChatSidebar.tsx b/src/components/AIChatSidebar.tsx index 149805d..380cab5 100644 --- a/src/components/AIChatSidebar.tsx +++ b/src/components/AIChatSidebar.tsx @@ -184,7 +184,7 @@ export default function AIChatSidebar({ isOpen, onClose, currentService }: AICha if (targetConv.title === "Nouvelle discussion") { fetchConversations(); // et on met à jour la reférence locale pour ne pas avoir de glitch visuel - setCurrentConv(prev => prev ? {...prev, title: text.substring(0, 30)} : prev); + setCurrentConv((prev: Conversation | null) => prev ? {...prev, title: text.substring(0, 30)} : prev); } } else if (data.error) { setIsTyping(false); diff --git a/src/components/LogTerminal.tsx b/src/components/LogTerminal.tsx index be4cdab..436781a 100644 --- a/src/components/LogTerminal.tsx +++ b/src/components/LogTerminal.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useState, useRef } from 'react'; +import { useEffect, useState, useRef } from 'react'; import { io, Socket } from 'socket.io-client'; import { Download, Sparkles } from 'lucide-react'; import type { LogService } from '../types'; diff --git a/src/components/ProtectedRoute.tsx b/src/components/ProtectedRoute.tsx index 030035e..5204da5 100644 --- a/src/components/ProtectedRoute.tsx +++ b/src/components/ProtectedRoute.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import { Navigate, Outlet } from 'react-router-dom'; import { useAuth } from '../context/AuthContext'; diff --git a/src/types.ts b/src/types.ts index da54ce0..18fe7eb 100644 --- a/src/types.ts +++ b/src/types.ts @@ -13,3 +13,15 @@ export interface GlobalSettings { ollamaModel: string; searxngUrl: string; } + +export interface Message { + role: 'user' | 'assistant' | 'system'; + content: string; +} + +export interface Conversation { + id: number; + title: string; + updatedAt: string; + messages?: Message[]; +} diff --git a/src/views/HomeView.tsx b/src/views/HomeView.tsx index 0d1c7dc..579d87f 100644 --- a/src/views/HomeView.tsx +++ b/src/views/HomeView.tsx @@ -1,4 +1,4 @@ -import React, { useState, useEffect } from 'react'; +import { useState, useEffect } from 'react'; import { useNavigate } from 'react-router-dom'; import { PlusCircle, Clock, Server, HardDrive, LayoutGrid } from 'lucide-react'; import AddServiceModal from '../components/AddServiceModal'; diff --git a/src/views/LoginView.tsx b/src/views/LoginView.tsx index 0614df7..fd67e4c 100644 --- a/src/views/LoginView.tsx +++ b/src/views/LoginView.tsx @@ -1,7 +1,7 @@ import React, { useState } from 'react'; import { useNavigate, Link } from 'react-router-dom'; import { useAuth } from '../context/AuthContext'; -import { LogIn, UserPlus, Mail, Lock, ShieldCheck } from 'lucide-react'; +import { LogIn, Mail, Lock, ShieldCheck } from 'lucide-react'; export default function LoginView() { const [email, setEmail] = useState(''); diff --git a/src/views/ServiceView.tsx b/src/views/ServiceView.tsx index d3f31f3..d5d6e90 100644 --- a/src/views/ServiceView.tsx +++ b/src/views/ServiceView.tsx @@ -1,4 +1,4 @@ -import React, { useState, useEffect } from 'react'; +import { useState, useEffect } from 'react'; import { useNavigate, useParams } from 'react-router-dom'; import { ArrowLeft, Server, HardDrive, Trash2 } from 'lucide-react'; import type { LogService } from '../types';