[FEATURE] Add AI-based /ask command (complementing #54) #56
|
@ -70,6 +70,11 @@ You can also run Kowalski using Docker, which simplifies the setup process. Make
|
|||
|
||||
2. **Make sure to setup your `.env` file first!**
|
||||
|
||||
> [!TIP]
|
||||
> If you intend to setup AI, the defaults for Docker are already included (just uncomment) and don't need to be changed.
|
||||
>
|
||||
> Further setup may be needed for GPUs. See the Ollama documentation for more.
|
||||
|
||||
3. **Run the container**
|
||||
|
||||
```bash
|
||||
|
@ -129,7 +134,7 @@ chmod +x src/plugins/yt-dlp/yt-dlp
|
|||
|
||||
**Q:** How can I disable AI features?
|
||||
|
||||
**A:** AI features are disabled by default, unless you have set `ollamaApi` in your `.env` file. Please remove or comment out this line to disable all AI functionality.
|
||||
**A:** AI features are disabled by default, unless you have set `ollamaEnabled` to `true` in your `.env` file. Set it back to `false` to disable.
|
||||
|
||||
## Contributors
|
||||
|
||||
|
|
|
@ -227,8 +227,6 @@ export default (bot: Telegraf<Context>) => {
|
|||
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
||||
if (!ctx.message || !('text' in ctx.message)) return;
|
||||
const isAsk = ctx.message.text.startsWith("/ask")
|
||||
const model = isAsk ? flash_model : thinking_model
|
||||
console.log(model)
|
||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
||||
console.log(ctx.message.text)
|
||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
||||
const textCtx = ctx as TextContext;
|
||||
const reply_to_message_id = replyToMessageId(textCtx)
|
||||
const Strings = getStrings(languageCode(textCtx))
|
||||
|
|
|||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|
@ -32,7 +32,6 @@ import { flash_model, thinking_model } from "../commands/ai"
|
|||
|
||||
class Logger {
|
||||
private static instance: Logger
|
||||
private thinking: boolean = false
|
||||
|
||||
private constructor() {}
|
||||
|
||||
|
@ -44,7 +43,7 @@ class Logger {
|
|||
}
|
||||
|
||||
logCmdStart(user: string, type: "ask" | "think"): void {
|
||||
console.log(`\n[✨ AI | START] Received /${type} for model ${type === "ask" ? flash_model : thinking_model} from ${user}`)
|
||||
console.log(`\n[✨ AI | START] Received /${type} for model ${type === "ask" ? flash_model : thinking_model}`)
|
||||
}
|
||||
|
||||
logThinking(chatId: number, messageId: number, thinking: boolean): void {
|
||||
|
@ -61,7 +60,7 @@ class Logger {
|
|||
}
|
||||
|
||||
logPrompt(prompt: string): void {
|
||||
console.log(`[✨ AI | PROMPT] ${prompt.length} chars: ${prompt.substring(0, 50)}${prompt.length > 50 ? "..." : ""}`)
|
||||
console.log(`[✨ AI | PROMPT] ${prompt.length} chars input`)
|
||||
}
|
||||
|
||||
logError(error: any): void {
|
||||
|
|
Don't use axios like this, check https://axios-http.com/docs/instance
Why are you printing p1?
There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)