blob: 60e1757a2cfa6f7db08c46942147172df5ab951f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
// Extracted from newOS4 index.html — WebXAIAliasModule
class WebXAIAliasModule {
constructor() { this.commands = {}; this.terminal = null; }
getHelpInfo() {
return {
'webxai': 'webxai <question> — Send a question to the AI assistant',
'wx': 'wx <question> — Alias for webxai',
'webx': 'webx <question> — Alias for webxai'
};
}
registerCommands() {
this.commands['webxai'] = (args) => this.forwardToAI(args);
this.commands['wx'] = (args) => this.forwardToAI(args);
this.commands['webx'] = (args) => this.forwardToAI(args);
}
forwardToAI(args) {
if (!args[0]) {
this.terminal.print("Usage: webxai <your-question>", "warning"); return;
}
if (this.terminal.moduleManager.modules['WebX11AIAssistantModule']) {
this.terminal.moduleManager.modules['WebX11AIAssistantModule'].chat(args);
} else {
this.terminal.ollamaManager.chat(args.join(' '));
}
}
}
|