This commit is contained in:
seb
2026-10-03 23:13:40 +02:00
parent 6520665dcf
commit 3b74c12f4e
36 changed files with 3669 additions and 2183 deletions

123
API.modelconversation.md Normal file
View File

@@ -0,0 +1,123 @@
# modelconversation
This document is auto-generated from the JSDoc comments in `src/store` by running `npm run api-doc`.
## `modelconversation.create`
*Source: `src/store/modelconversation/create.js`*
Creates a new (idle) model conversation for the user in the selected company.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `input` | `object` | Conversation input. |
| `input.provider` | `string` | LLM provider name. |
| `input.model` | `string` | Model identifier. |
| `[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}>`
**Throws**
`Error` — 'Provider required' or 'Model required'.
**Example**
```js
const c = await store.modelconversation.create(42, { provider: 'openrouter', model: 'openai/gpt-5' });
```
## `modelconversation.delete`
*Source: `src/store/modelconversation/delete.js`*
Deletes a model conversation by ID for the user in the selected company.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `conversationId` | `number` | The conversation id. |
| `[tx]` | `object` | Optional transaction to run within. |
**Returns**
`Promise<void>`
**Throws**
`Error` — 'Conversation not found'.
## `modelconversation.get`
*Source: `src/store/modelconversation/get.js`*
Gets a single model conversation by ID for the user in the selected company.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `conversationId` | `number` | The conversation id. |
| `[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}>`
**Throws**
`Error` — 'Conversation not found'.
## `modelconversation.list`
*Source: `src/store/modelconversation/list.js`*
Lists the user's own model conversations in the selected company, newest activity first.
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `[tx]` | `object` | Optional transaction to run within. |
**Returns**
`Promise<Array<{id: number, companyuser_id: number, provider: string, model: string, created_at: string, updated_at: string, state: string}>>`
**Example**
```js
const conversations = await store.modelconversation.list(42);
```
## `modelconversation.setState`
*Source: `src/store/modelconversation/setState.js`*
Sets the state of a model conversation ('idle' | 'busy').
**Parameters**
| Name | Type | Description |
| --- | --- | --- |
| `googleAuthId` | `number` | The id of the Google auth user. |
| `conversationId` | `number` | The conversation id. |
| `state` | `string` | The new state ('idle' | 'busy'). |
| `[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}>`
**Throws**
`Error` — 'Invalid state' or 'Conversation not found'.