Merge pull request 'Corregir para que los mensajes se archiven solo con asistente y usuario' (#24) from issue/7-hacer-la-edge-function-que-te-d-sugerencias into main
Reviewed-on: AlexRG/genesis-2#24
This commit was merged in pull request #24.
This commit is contained in:
@@ -353,11 +353,18 @@ app.delete(`${prefix}/conversations/:id/archive`, async (c) => {
|
|||||||
row.openai_conversation_id,
|
row.openai_conversation_id,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const conversacion = items.data.filter((it: any) =>
|
||||||
|
it.type === "message" && (it.role === "assistant" || it.role === "user")
|
||||||
|
).map((it: any) => ({
|
||||||
|
role: it.role,
|
||||||
|
content: it.content.map((c: any) => c.text).join(""),
|
||||||
|
}));
|
||||||
|
|
||||||
// Guardar y marcar como ARCHIVADA
|
// Guardar y marcar como ARCHIVADA
|
||||||
const { error: upErr } = await supabase.from("conversaciones_plan")
|
const { error: upErr } = await supabase.from("conversaciones_plan")
|
||||||
.update({
|
.update({
|
||||||
estado: "ARCHIVADA",
|
estado: "ARCHIVADA",
|
||||||
conversacion_json: items,
|
conversacion_json: conversacion,
|
||||||
})
|
})
|
||||||
.eq("id", conversation_plan_id);
|
.eq("id", conversation_plan_id);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user