From da0bf43d735175ddf57f6afc848390ec8f351bfa Mon Sep 17 00:00:00 2001 From: Jabber Developer Date: Thu, 30 Apr 2026 19:24:39 +0000 Subject: [PATCH] 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' --- src/command/cmd_funcs.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index 2f522ddf..26f6ab03 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -10855,7 +10855,9 @@ gboolean cmd_ai_correct(ProfWin* window, const char* const command, gchar** args) { // /ai correct - 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; }