Features
This commit is contained in:
1 parent
d687308395
commit
ffc7dc68fe
5 files changed
+19
-6
No files matched your search
+4
-1
@@ -15,8 +15,11 @@ async function main() {
|
||||
try {
|
||||
const services = await prisma.service.findMany();
|
||||
console.log('Services found in DB:', JSON.stringify(services, null, 2));
|
||||
|
||||
const settings = await prisma.globalSettings.findMany();
|
||||
console.log('GlobalSettings found in DB:', JSON.stringify(settings, null, 2));
|
||||
} catch (e) {
|
||||
console.error('Error querying services:', e);
|
||||
console.error('Error querying DB:', e);
|
||||
} finally {
|
||||
await prisma.$disconnect();
|
||||
}
|
||||
|
||||
@@ -51,4 +51,5 @@ model GlobalSettings {
|
||||
ollamaUrl String? // e.g., http://localhost:11434
|
||||
ollamaModel String? // e.g., qwen:7b
|
||||
searxngUrl String? // e.g., http://localhost:8080
|
||||
aiLanguage String? // e.g., Français, English
|
||||
}
|
||||
+6
-4
@@ -122,17 +122,19 @@ app.get('/api/os/services', async (req, res) => {
|
||||
app.get('/api/settings', async (req, res) => {
|
||||
let settings = await prisma.globalSettings.findUnique({ where: { id: 1 } });
|
||||
if (!settings) {
|
||||
settings = await prisma.globalSettings.create({ data: { id: 1, notionToken: '', notionDbId: '', ollamaUrl: '', ollamaModel: '', searxngUrl: '' } });
|
||||
settings = await prisma.globalSettings.create({
|
||||
data: { id: 1, notionToken: '', notionDbId: '', ollamaUrl: '', ollamaModel: '', searxngUrl: '', aiLanguage: 'Français' }
|
||||
});
|
||||
}
|
||||
res.json(settings);
|
||||
});
|
||||
|
||||
app.post('/api/settings', async (req, res) => {
|
||||
const { notionToken, notionDbId, ollamaUrl, ollamaModel, searxngUrl } = req.body;
|
||||
const { notionToken, notionDbId, ollamaUrl, ollamaModel, searxngUrl, aiLanguage } = req.body;
|
||||
const settings = await prisma.globalSettings.upsert({
|
||||
where: { id: 1 },
|
||||
update: { notionToken, notionDbId, ollamaUrl, ollamaModel, searxngUrl },
|
||||
create: { id: 1, notionToken, notionDbId, ollamaUrl, ollamaModel, searxngUrl }
|
||||
update: { notionToken, notionDbId, ollamaUrl, ollamaModel, searxngUrl, aiLanguage },
|
||||
create: { id: 1, notionToken, notionDbId, ollamaUrl, ollamaModel, searxngUrl, aiLanguage }
|
||||
});
|
||||
res.json(settings);
|
||||
});
|
||||
|
||||
@@ -24,6 +24,11 @@ router.post('/conversations', async (req: AuthRequest, res: Response) => {
|
||||
const { title } = req.body;
|
||||
try {
|
||||
const userId = req.user!.id;
|
||||
|
||||
// Récupérer la langue préférée
|
||||
const settings = await prisma.globalSettings.findUnique({ where: { id: 1 } });
|
||||
const language = settings?.aiLanguage || "Français";
|
||||
|
||||
const conversation = await prisma.conversation.create({
|
||||
data: {
|
||||
title: title || "Nouvelle discussion",
|
||||
@@ -31,7 +36,7 @@ router.post('/conversations', async (req: AuthRequest, res: Response) => {
|
||||
messages: {
|
||||
create: {
|
||||
role: 'system',
|
||||
content: "Tu es un assistant expert DevOps intégré au système LogAI. Ton rôle est d'aider l'utilisateur à interpréter les logs, déboguer les services (Docker/OS) et conseiller sur l'infrastructure. Réponds de manière concise et technique en français."
|
||||
content: `Tu es un assistant expert DevOps intégré au système LogAI. Ton rôle est d'aider l'utilisateur à interpréter les logs, déboguer les services (Docker/OS) et conseiller sur l'infrastructure. Réponds exclusivement en ${language}.`
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -75,9 +75,11 @@ Requête de recherche (uniquement la requête ou "NORMAL") :`;
|
||||
}
|
||||
|
||||
// ÉTAPE 2 : Analyse finale de chaque log du paquet
|
||||
const language = settings.aiLanguage || "Français";
|
||||
const finalPrompt = `
|
||||
Tu es un expert DevOps. Analyse individuellement chaque log du paquet ci-dessous.
|
||||
Utilise les résultats de recherche web fournis pour proposer des solutions concrètes aux erreurs.
|
||||
Réponds exclusivement en ${language}.
|
||||
${webContext}
|
||||
|
||||
---
|
||||
|
||||
Reference in new issue
Block a user