This commit is contained in:
seb
2026-10-10 00:39:23 +02:00
parent 2c36a705c4
commit ff54fe3a18
30 changed files with 2250 additions and 2256 deletions

View File

@@ -0,0 +1,51 @@
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 }] }
*/
list() {
return http('/api/modelconversation');
},
/**
* GET /api/modelconversation/:id
* Fetch conversation details by ID.
* @param {number|string} id
*/
get(id) {
return http(`/api/modelconversation/${encodeURIComponent(id)}`);
},
/**
* 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 } }
*/
create(body) {
return http('/api/modelconversation', { method: 'POST', body });
},
/**
* GET /api/modelconversation/:id/message
* Lists conversation messages, oldest first.
* → 200 { messages: [{ id, conversation_id, created_at, role, message }] }
*/
listMessages(id) {
return http(`/api/modelconversation/${encodeURIComponent(id)}/message`);
},
addMessage(id, body) {
return http(`/api/modelconversation/${encodeURIComponent(id)}/message`, { method: 'POST', body });
},
/**
* DELETE /api/modelconversation/:id
*/
delete(id) {
return http(`/api/modelconversation/${encodeURIComponent(id)}`, { method: 'DELETE' });
},
};