This commit is contained in:
seb
2026-10-12 18:01:25 +02:00
parent 2e961252f7
commit 88ff9e08a9
12 changed files with 104 additions and 27 deletions

View File

@@ -16,15 +16,16 @@ Creates a new (idle) model conversation for the user in the selected company.
| `input` | `object` | Conversation input. |
| `input.provider` | `string` | LLM provider name. |
| `input.model` | `string` | Model identifier. |
| `[input.started_by]` | `number|null` | Id of the conversation that starts this one as a subagent (unenforced reference; omit/null for a top-level conversation). |
| `[tx]` | `object` | Optional transaction to run within. |
**Returns**
`Promise<{id: number, companyuser_id: number, provider: string, model: string, created_at: string, updated_at: string, state: string}>`
`Promise<{id: number, companyuser_id: number, provider: string, model: string, created_at: string, updated_at: string, state: string, started_by: number|null}>`
**Throws**
`Error` — 'Provider required' or 'Model required'.
`Error` — 'Provider required', 'Model required' or 'Invalid started_by'.
**Example**
@@ -36,7 +37,7 @@ const c = await store.modelconversation.create(42, { provider: 'openrouter', mod
*Source: `src/store/modelconversation/delete.js`*
Deletes a model conversation by ID for the user in the selected company.
Deletes a model conversation by ID for the user in the selected company, together with every subagent conversation below it (`started_by` chain, recursively) and their messages.
**Parameters**
@@ -70,7 +71,7 @@ Gets a single model conversation by ID for the user in the selected company.
**Returns**
`Promise<{id: number, companyuser_id: number, provider: string, model: string, created_at: string, updated_at: string, state: string}>`
`Promise<{id: number, companyuser_id: number, provider: string, model: string, created_at: string, updated_at: string, state: string, started_by: number|null}>`
**Throws**
@@ -91,7 +92,7 @@ Lists the user's own model conversations in the selected company, newest activit
**Returns**
`Promise<Array<{id: number, companyuser_id: number, provider: string, model: string, created_at: string, updated_at: string, state: string}>>`
`Promise<Array<{id: number, companyuser_id: number, provider: string, model: string, created_at: string, updated_at: string, state: string, started_by: number|null, first_user_message: string|null}>>` — `started_by` is the originating conversation id for subagent conversations (null otherwise), so clients can build a tree. `first_user_message` is the stored `message` payload of the conversation's first `user` message (null if none yet).
**Example**
@@ -116,7 +117,7 @@ Sets the state of a model conversation ('idle' | 'busy').
**Returns**
`Promise<{id: number, companyuser_id: number, provider: string, model: string, created_at: string, updated_at: string, state: string}>`
`Promise<{id: number, companyuser_id: number, provider: string, model: string, created_at: string, updated_at: string, state: string, started_by: number|null}>`
**Throws**