aboutsummaryrefslogtreecommitdiff
path: root/modules/core/module-aiasm.js
diff options
context:
space:
mode:
Diffstat (limited to 'modules/core/module-aiasm.js')
-rw-r--r--modules/core/module-aiasm.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/modules/core/module-aiasm.js b/modules/core/module-aiasm.js
new file mode 100644
index 0000000..60e1757
--- /dev/null
+++ b/modules/core/module-aiasm.js
@@ -0,0 +1,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(' '));
+ }
+ }
+ }