[FEATURE] Add AI-based /ask command (complementing #54) #56

Merged
lucmsilva651 merged 14 commits from ai-features into main 2025-06-28 19:22:15 +00:00
Showing only changes of commit b9173f4bda - Show all commits

View file

@ -251,7 +251,7 @@ export default (bot: Telegraf<Context>) => {
GiovaniFZ commented 2025-06-28 13:52:15 +00:00 (Migrated from github.com)

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
GiovaniFZ commented 2025-06-28 13:53:07 +00:00 (Migrated from github.com)

Why are you printing p1?

Why are you printing p1?
GiovaniFZ commented 2025-06-28 13:56:48 +00:00 (Migrated from github.com)

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 ;)
ihatenodejs commented 2025-06-28 16:13:06 +00:00 (Migrated from github.com)

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
GiovaniFZ commented 2025-06-28 13:52:15 +00:00 (Migrated from github.com)

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
GiovaniFZ commented 2025-06-28 13:53:07 +00:00 (Migrated from github.com)

Why are you printing p1?

Why are you printing p1?
GiovaniFZ commented 2025-06-28 13:56:48 +00:00 (Migrated from github.com)

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 ;)
ihatenodejs commented 2025-06-28 16:13:06 +00:00 (Migrated from github.com)

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
...({ reply_to_message_id })
})
const fixedMsg = message.replace(/\/ask /, "")
GiovaniFZ commented 2025-06-28 13:52:15 +00:00 (Migrated from github.com)

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
GiovaniFZ commented 2025-06-28 13:53:07 +00:00 (Migrated from github.com)

Why are you printing p1?

Why are you printing p1?
GiovaniFZ commented 2025-06-28 13:56:48 +00:00 (Migrated from github.com)

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 ;)
ihatenodejs commented 2025-06-28 16:13:06 +00:00 (Migrated from github.com)

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 fixedMsg = message.replace(/\/ask /, "").replace(/\/think /, "")
GiovaniFZ commented 2025-06-28 13:52:15 +00:00 (Migrated from github.com)

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
GiovaniFZ commented 2025-06-28 13:53:07 +00:00 (Migrated from github.com)

Why are you printing p1?

Why are you printing p1?
GiovaniFZ commented 2025-06-28 13:56:48 +00:00 (Migrated from github.com)

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 ;)
ihatenodejs commented 2025-06-28 16:13:06 +00:00 (Migrated from github.com)

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 (fixedMsg.length < 1) {
await ctx.reply(Strings.askNoMessage, {
parse_mode: 'Markdown',
@ -263,7 +263,7 @@ export default (bot: Telegraf<Context>) => {
GiovaniFZ commented 2025-06-28 13:52:15 +00:00 (Migrated from github.com)

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
GiovaniFZ commented 2025-06-28 13:53:07 +00:00 (Migrated from github.com)

Why are you printing p1?

Why are you printing p1?
GiovaniFZ commented 2025-06-28 13:56:48 +00:00 (Migrated from github.com)

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 ;)
ihatenodejs commented 2025-06-28 16:13:06 +00:00 (Migrated from github.com)

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
GiovaniFZ commented 2025-06-28 13:52:15 +00:00 (Migrated from github.com)

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
GiovaniFZ commented 2025-06-28 13:53:07 +00:00 (Migrated from github.com)

Why are you printing p1?

Why are you printing p1?
GiovaniFZ commented 2025-06-28 13:56:48 +00:00 (Migrated from github.com)

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 ;)
ihatenodejs commented 2025-06-28 16:13:06 +00:00 (Migrated from github.com)

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
logger.logPrompt(fixedMsg)
const prompt = sanitizeForJson(
`You are a helpful assistant called ${botName}.
GiovaniFZ commented 2025-06-28 13:52:15 +00:00 (Migrated from github.com)

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
GiovaniFZ commented 2025-06-28 13:53:07 +00:00 (Migrated from github.com)

Why are you printing p1?

Why are you printing p1?
GiovaniFZ commented 2025-06-28 13:56:48 +00:00 (Migrated from github.com)

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 ;)
ihatenodejs commented 2025-06-28 16:13:06 +00:00 (Migrated from github.com)

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
`You are a plaintext-only, helpful assistant called ${botName}.
GiovaniFZ commented 2025-06-28 13:52:15 +00:00 (Migrated from github.com)

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
GiovaniFZ commented 2025-06-28 13:53:07 +00:00 (Migrated from github.com)

Why are you printing p1?

Why are you printing p1?
GiovaniFZ commented 2025-06-28 13:56:48 +00:00 (Migrated from github.com)

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 ;)
ihatenodejs commented 2025-06-28 16:13:06 +00:00 (Migrated from github.com)

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
Current Date/Time (UTC): ${new Date().toLocaleString()}
---

GiovaniFZ commented 2025-06-28 13:52:15 +00:00 (Migrated from github.com)

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
GiovaniFZ commented 2025-06-28 13:53:07 +00:00 (Migrated from github.com)

Why are you printing p1?

Why are you printing p1?
GiovaniFZ commented 2025-06-28 13:56:48 +00:00 (Migrated from github.com)

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 ;)
ihatenodejs commented 2025-06-28 16:13:06 +00:00 (Migrated from github.com)

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
GiovaniFZ commented 2025-06-28 13:52:15 +00:00 (Migrated from github.com)

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
GiovaniFZ commented 2025-06-28 13:53:07 +00:00 (Migrated from github.com)

Why are you printing p1?

Why are you printing p1?
GiovaniFZ commented 2025-06-28 13:56:48 +00:00 (Migrated from github.com)

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 ;)
ihatenodejs commented 2025-06-28 16:13:06 +00:00 (Migrated from github.com)

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