mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-30 09:36:21 +00:00
refactor(ai): remove cmd_ai_correct function
The /ai correct command implementation has been removed.
This commit is contained in:
@@ -11193,58 +11193,6 @@ cmd_ai_clear(ProfWin* window, const char* const command, gchar** args)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
|
||||||
cmd_ai_correct(ProfWin* window, const char* const command, gchar** args)
|
|
||||||
{
|
|
||||||
// /ai correct <message>
|
|
||||||
// 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 <provider>/<model>' 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
|
gboolean
|
||||||
cmd_ai_providers(ProfWin* window, const char* const command, gchar** args)
|
cmd_ai_providers(ProfWin* window, const char* const command, gchar** args)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user