mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-26 21:46:21 +00:00
fix(ai): join multi-word arguments in cmd_ai_correct
Use g_strjoinv to join all arguments from args[1] onwards into a single prompt string. Previously only args[1] was used, truncating multi-word prompts like '/ai correct hello world' to just 'hello'
This commit is contained in:
@@ -10855,7 +10855,9 @@ gboolean
|
|||||||
cmd_ai_correct(ProfWin* window, const char* const command, gchar** args)
|
cmd_ai_correct(ProfWin* window, const char* const command, gchar** args)
|
||||||
{
|
{
|
||||||
// /ai correct <message>
|
// /ai correct <message>
|
||||||
if (args[1] == NULL) {
|
// Join all arguments from args[1] onwards to support multi-word prompts
|
||||||
|
auto_gchar gchar* prompt = g_strjoinv(" ", &args[1]);
|
||||||
|
if (prompt == NULL || strlen(prompt) == 0) {
|
||||||
cons_bad_cmd_usage(command);
|
cons_bad_cmd_usage(command);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -10892,11 +10894,11 @@ cmd_ai_correct(ProfWin* window, const char* const command, gchar** args)
|
|||||||
// Replace the last user message
|
// Replace the last user message
|
||||||
AIMessage* msg = last_user_msg->data;
|
AIMessage* msg = last_user_msg->data;
|
||||||
g_free(msg->content);
|
g_free(msg->content);
|
||||||
msg->content = g_strdup(args[1]);
|
msg->content = g_strdup(prompt);
|
||||||
|
|
||||||
// Resend the prompt
|
// Resend the prompt
|
||||||
cons_show("Correcting message...");
|
cons_show("Correcting message...");
|
||||||
ai_send_prompt(aiwin->session, args[1], aiwin);
|
ai_send_prompt(aiwin->session, prompt, aiwin);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user