import { http } from './http.js'; export const modelconversation = { /** * GET /api/modelconversation * Lists the user's model conversations in the selected company. * → 200 { conversations: [{ id, companyuser_id, provider, model, created_at, updated_at, state }] } */ // #region GET /api/modelconversation — list list() { return http('/api/modelconversation'); }, // #endregion /** * GET /api/modelconversation/:id * Fetch conversation details by ID. * @param {number|string} id */ // #region GET /api/modelconversation/:id — get get(id) { return http(`/api/modelconversation/${encodeURIComponent(id)}`); }, // #endregion /** * POST /api/modelconversation * Creates a new conversation in state 'idle'. * Body: { provider, model } * → 201 { conversation: { id, companyuser_id, provider, model, created_at, updated_at, state } } */ // #region POST /api/modelconversation — create create(body) { return http('/api/modelconversation', { method: 'POST', body }); }, // #endregion /** * GET /api/modelconversation/:id/message * Lists conversation messages, oldest first. * → 200 { messages: [{ id, conversation_id, created_at, role, message }] } */ // #region GET /api/modelconversation/:id/message — listMessages listMessages(id) { return http(`/api/modelconversation/${encodeURIComponent(id)}/message`); }, // #endregion // #region POST /api/modelconversation/:id/message — addMessage addMessage(id, body) { return http(`/api/modelconversation/${encodeURIComponent(id)}/message`, { method: 'POST', body }); }, // #endregion /** * DELETE /api/modelconversation/:id */ // #region DELETE /api/modelconversation/:id — delete delete(id) { return http(`/api/modelconversation/${encodeURIComponent(id)}`, { method: 'DELETE' }); }, // #endregion };