mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-18 16:16: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)
|
||||
{
|
||||
// /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);
|
||||
return TRUE;
|
||||
}
|
||||
@@ -10892,11 +10894,11 @@ cmd_ai_correct(ProfWin* window, const char* const command, gchar** args)
|
||||
// Replace the last user message
|
||||
AIMessage* msg = last_user_msg->data;
|
||||
g_free(msg->content);
|
||||
msg->content = g_strdup(args[1]);
|
||||
msg->content = g_strdup(prompt);
|
||||
|
||||
// Resend the prompt
|
||||
cons_show("Correcting message...");
|
||||
ai_send_prompt(aiwin->session, args[1], aiwin);
|
||||
ai_send_prompt(aiwin->session, prompt, aiwin);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user