diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index adbcb57f..f2de429c 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -11193,58 +11193,6 @@ cmd_ai_clear(ProfWin* window, const char* const command, gchar** args) return TRUE; } -gboolean -cmd_ai_correct(ProfWin* window, const char* const command, gchar** args) -{ - // /ai correct - // 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; - } - - // Get current AI window - ProfAiWin* aiwin = wins_get_ai(); - if (!aiwin) { - cons_show("No active AI chat window. Use '/ai start /' first."); - return TRUE; - } - - assert(aiwin->memcheck == PROFAIWIN_MEMCHECK); - - if (!aiwin->session) { - cons_show("No active session in this chat window."); - return TRUE; - } - - // Get the last user message and replace it - GList* history = aiwin->session->history; - GList* last_user_msg = NULL; - for (GList* curr = history; curr; curr = g_list_next(curr)) { - AIMessage* msg = curr->data; - if (g_strcmp0(msg->role, "user") == 0) { - last_user_msg = curr; - } - } - - if (!last_user_msg) { - cons_show("No user messages in this chat to correct."); - return TRUE; - } - - // Replace the last user message - AIMessage* msg = last_user_msg->data; - g_free(msg->content); - msg->content = g_strdup(prompt); - - // Resend the prompt - cons_show("Correcting message..."); - ai_send_prompt(aiwin->session, prompt, aiwin); - - return TRUE; -} - gboolean cmd_ai_providers(ProfWin* window, const char* const command, gchar** args) {