Public Access
Fix git and also replace functions calls with borrowered string because why did I even code it otherwise in the first place
This commit is contained in:
1 parent
4298cf385b
commit
a22f5781c2
11 files changed
+89
-93
No files matched your search
+16
-16
@@ -34,7 +34,7 @@ pub async fn prompt(
|
||||
Err(e) => {
|
||||
warn!("TG_BOT_OLLAMA_HOST environment variable missing: {}", e);
|
||||
let err_msg = "Error: Expected an ollama url in the environment (`TG_BOT_OLLAMA_HOST`).";
|
||||
trace_message(err_msg.to_string(), channel_str.clone(), guild_str.clone()).await;
|
||||
trace_message(err_msg, channel_str.clone(), guild_str.clone()).await;
|
||||
ctx.say(err_msg).await?;
|
||||
return Ok(());
|
||||
}
|
||||
@@ -65,7 +65,7 @@ pub async fn prompt(
|
||||
Err(e) => {
|
||||
error!("Failed to connect to Ollama server at {}: {}", formatted_host, e);
|
||||
let err_msg = format!("Error: Failed to connect to Ollama: {}", e);
|
||||
trace_message(err_msg.clone(), channel_str.clone(), guild_str.clone()).await;
|
||||
trace_message(&err_msg, channel_str.clone(), guild_str.clone()).await;
|
||||
ctx.say(err_msg).await?;
|
||||
return Ok(());
|
||||
}
|
||||
@@ -103,7 +103,7 @@ pub async fn prompt(
|
||||
trace!("Generated system prompt for model creation (length: {} chars)", system_prompt.len());
|
||||
trace!("System prompt content: {}", system_prompt);
|
||||
let notice_msg = "EwiAI model is missing or out of date. Creating/updating model (this may take a bit)...";
|
||||
trace_message(notice_msg.to_string(), channel_str.clone(), guild_str.clone()).await;
|
||||
trace_message(notice_msg, channel_str.clone(), guild_str.clone()).await;
|
||||
let _ = ctx.say(notice_msg).await?;
|
||||
|
||||
trace!("Sending create_model request to Ollama for 'EwiAI' based on 'gemma4:e2b-it-qat'...");
|
||||
@@ -112,7 +112,7 @@ pub async fn prompt(
|
||||
.from_model("gemma4:e2b-it-qat".into())).await {
|
||||
error!("Failed to create model EwiAI: {}", e);
|
||||
let err_msg = format!("Error creating model: {}", e);
|
||||
trace_message(err_msg.clone(), channel_str.clone(), guild_str.clone()).await;
|
||||
trace_message(&err_msg, channel_str.clone(), guild_str.clone()).await;
|
||||
ctx.say(err_msg).await?;
|
||||
return Ok(());
|
||||
}
|
||||
@@ -155,7 +155,7 @@ pub async fn prompt(
|
||||
trace!("Final prompt: {}", final_prompt);
|
||||
|
||||
let thinking_msg = "Thinking...\n-# The hardware this thing runs is really slow, expect a long wait";
|
||||
trace_message(thinking_msg.to_string(), channel_str.clone(), guild_str.clone()).await;
|
||||
trace_message(thinking_msg, channel_str.clone(), guild_str.clone()).await;
|
||||
trace!("Sending initial thinking message...");
|
||||
let reply = ctx.say(thinking_msg).await?;
|
||||
|
||||
@@ -169,7 +169,7 @@ pub async fn prompt(
|
||||
Err(e) => {
|
||||
error!("Error starting generation stream with Ollama: {}", e);
|
||||
let err_msg = format!("Error during generation: {}", e);
|
||||
trace_message(err_msg.clone(), channel_str.clone(), guild_str.clone()).await;
|
||||
trace_message(&err_msg, channel_str.clone(), guild_str.clone()).await;
|
||||
reply.edit(ctx, CreateReply::default().content(err_msg)).await?;
|
||||
return Ok(());
|
||||
}
|
||||
@@ -204,7 +204,7 @@ pub async fn prompt(
|
||||
Err(e) => {
|
||||
error!("Error encountered while reading stream chunk: {}", e);
|
||||
let err_msg = format!("{} [Stream Error: {}]", response_text, e);
|
||||
trace_message(err_msg.clone(), channel_str.clone(), guild_str.clone()).await;
|
||||
trace_message(&err_msg, channel_str.clone(), guild_str.clone()).await;
|
||||
let _ = reply.edit(ctx, CreateReply::default().content(err_msg)).await;
|
||||
return Ok(());
|
||||
}
|
||||
@@ -229,7 +229,7 @@ pub async fn prompt(
|
||||
trace!("No final response stats available from stream");
|
||||
}
|
||||
|
||||
trace_message(response_text.clone(), channel_str.clone(), guild_str.clone()).await;
|
||||
trace_message(&response_text, channel_str.clone(), guild_str.clone()).await;
|
||||
trace!("Sending final edit to reply message...");
|
||||
let _ = reply.edit(ctx, CreateReply::default().content(&response_text)).await;
|
||||
debug!("prompt command finished successfully for user {}", ctx.author().name);
|
||||
@@ -259,7 +259,7 @@ pub async fn answer(
|
||||
Err(e) => {
|
||||
warn!("TG_BOT_OLLAMA_HOST environment variable missing: {}", e);
|
||||
let err_msg = "Error: Expected an ollama url in the environment (`TG_BOT_OLLAMA_HOST`).";
|
||||
trace_message(err_msg.to_string(), channel_str.clone(), guild_str.clone()).await;
|
||||
trace_message(err_msg, channel_str.clone(), guild_str.clone()).await;
|
||||
ctx.say(err_msg).await?;
|
||||
return Ok(());
|
||||
}
|
||||
@@ -290,7 +290,7 @@ pub async fn answer(
|
||||
Err(e) => {
|
||||
error!("Failed to connect to Ollama server at {}: {}", formatted_host, e);
|
||||
let err_msg = format!("Error: Failed to connect to Ollama: {}", e);
|
||||
trace_message(err_msg.clone(), channel_str.clone(), guild_str.clone()).await;
|
||||
trace_message(&err_msg, channel_str.clone(), guild_str.clone()).await;
|
||||
ctx.say(err_msg).await?;
|
||||
return Ok(());
|
||||
}
|
||||
@@ -328,7 +328,7 @@ pub async fn answer(
|
||||
trace!("Generated system prompt for model creation (length: {} chars)", system_prompt.len());
|
||||
trace!("System prompt content: {}", system_prompt);
|
||||
let notice_msg = "EwiAI model is missing or out of date. Creating/updating model (this may take a bit)...";
|
||||
trace_message(notice_msg.to_string(), channel_str.clone(), guild_str.clone()).await;
|
||||
trace_message(notice_msg, channel_str.clone(), guild_str.clone()).await;
|
||||
let _ = ctx.say(notice_msg).await?;
|
||||
|
||||
trace!("Sending create_model request to Ollama for 'EwiAI' based on 'gemma4:e2b-it-qat'...");
|
||||
@@ -337,7 +337,7 @@ pub async fn answer(
|
||||
.from_model("gemma4:e2b-it-qat".into())).await {
|
||||
error!("Failed to create model EwiAI: {}", e);
|
||||
let err_msg = format!("Error creating model: {}", e);
|
||||
trace_message(err_msg.clone(), channel_str.clone(), guild_str.clone()).await;
|
||||
trace_message(&err_msg, channel_str.clone(), guild_str.clone()).await;
|
||||
ctx.say(err_msg).await?;
|
||||
return Ok(());
|
||||
}
|
||||
@@ -379,7 +379,7 @@ pub async fn answer(
|
||||
trace!("Final prompt: {}", final_prompt);
|
||||
|
||||
let thinking_msg = "Thinking...\n-# The hardware this thing runs is really slow, expect a long wait";
|
||||
trace_message(thinking_msg.to_string(), channel_str.clone(), guild_str.clone()).await;
|
||||
trace_message(thinking_msg, channel_str.clone(), guild_str.clone()).await;
|
||||
trace!("Sending initial thinking message...");
|
||||
let reply = ctx.say(thinking_msg).await?;
|
||||
|
||||
@@ -393,7 +393,7 @@ pub async fn answer(
|
||||
Err(e) => {
|
||||
error!("Error starting generation stream with Ollama: {}", e);
|
||||
let err_msg = format!("Error during generation: {}", e);
|
||||
trace_message(err_msg.clone(), channel_str.clone(), guild_str.clone()).await;
|
||||
trace_message(&err_msg, channel_str.clone(), guild_str.clone()).await;
|
||||
reply.edit(ctx, CreateReply::default().content(err_msg)).await?;
|
||||
return Ok(());
|
||||
}
|
||||
@@ -428,7 +428,7 @@ pub async fn answer(
|
||||
Err(e) => {
|
||||
error!("Error encountered while reading stream chunk: {}", e);
|
||||
let err_msg = format!("{} [Stream Error: {}]", response_text, e);
|
||||
trace_message(err_msg.clone(), channel_str.clone(), guild_str.clone()).await;
|
||||
trace_message(&err_msg, channel_str.clone(), guild_str.clone()).await;
|
||||
let _ = reply.edit(ctx, CreateReply::default().content(err_msg)).await;
|
||||
return Ok(());
|
||||
}
|
||||
@@ -453,7 +453,7 @@ pub async fn answer(
|
||||
trace!("No final response stats available from stream");
|
||||
}
|
||||
|
||||
trace_message(response_text.clone(), channel_str.clone(), guild_str.clone()).await;
|
||||
trace_message(&response_text, channel_str.clone(), guild_str.clone()).await;
|
||||
trace!("Sending final edit to reply message...");
|
||||
let _ = reply.edit(ctx, CreateReply::default().content(&response_text)).await;
|
||||
debug!("answer command finished successfully for user {}", ctx.author().name);
|
||||
|
||||
Reference in new issue
Block a user