fix(matrix-mana-bot): correct service method calls and add deploy script

- Fix AiHandler to use correct service methods:
  - setSessionModel instead of setModel
  - clearSessionHistory instead of clearHistory
  - compareModels for model comparison
- Fix TodoHandler to use index-based methods:
  - completeTaskByIndex instead of completeTask
  - deleteTaskByIndex instead of deleteTask
- Add deploy-mana-bot.sh script for full deployment automation

https://claude.ai/code/session_015bwcqVRiFmSydYTjvDJGTc
This commit is contained in:
Claude 2026-01-29 00:42:50 +00:00
parent e96d76ab8e
commit 370b5d3196
No known key found for this signature in database
3 changed files with 141 additions and 22 deletions

View file

@ -51,7 +51,7 @@ export class AiHandler {
return `❌ Modell "${modelName}" nicht gefunden.\n\nVerfügbar: ${available}`;
}
this.aiService.setModel(ctx.userId, modelName);
this.aiService.setSessionModel(ctx.userId, modelName);
this.logger.log(`User ${ctx.userId} switched to model ${modelName}`);
return `✅ Modell gewechselt zu: \`${modelName}\``;
@ -62,27 +62,12 @@ export class AiHandler {
return `**Verwendung:** \`!all [Deine Frage]\`\n\nBeispiel: \`!all Was ist 2+2?\``;
}
const models = await this.aiService.listModels();
if (models.length === 0) {
const results = await this.aiService.compareModels(question);
if (results.length === 0) {
return '❌ Keine Modelle gefunden. Ist Ollama gestartet?';
}
const results: { model: string; response: string; duration: number; error?: string }[] = [];
for (const model of models) {
const startTime = Date.now();
try {
this.logger.debug(`Querying model ${model.name}...`);
const response = await this.aiService.chat(ctx.userId, question, model.name);
const duration = Date.now() - startTime;
results.push({ model: model.name, response, duration });
} catch (error) {
const duration = Date.now() - startTime;
const errorMessage = error instanceof Error ? error.message : 'Unbekannter Fehler';
results.push({ model: model.name, response: '', duration, error: errorMessage });
}
}
let resultText = `**📊 Modellvergleich**\n\n**Frage:** "${question}"\n\n---\n\n`;
for (const result of results) {
@ -102,7 +87,7 @@ export class AiHandler {
}
async clearHistory(ctx: CommandContext): Promise<string> {
this.aiService.clearHistory(ctx.userId);
this.aiService.clearSessionHistory(ctx.userId);
this.logger.log(`User ${ctx.userId} cleared chat history`);
return '✅ Chat-Verlauf gelöscht.';
}

View file

@ -68,7 +68,7 @@ export class TodoHandler {
return '❌ Bitte gib eine gültige Aufgabennummer an.\n\nBeispiel: `!done 1`';
}
const task = await this.todoService.completeTask(ctx.userId, taskNumber);
const task = await this.todoService.completeTaskByIndex(ctx.userId, taskNumber);
if (!task) {
return `❌ Aufgabe #${taskNumber} nicht gefunden.`;
@ -85,7 +85,7 @@ export class TodoHandler {
return '❌ Bitte gib eine gültige Aufgabennummer an.\n\nBeispiel: `!delete 1`';
}
const task = await this.todoService.deleteTask(ctx.userId, taskNumber);
const task = await this.todoService.deleteTaskByIndex(ctx.userId, taskNumber);
if (!task) {
return `❌ Aufgabe #${taskNumber} nicht gefunden.`;