u
This commit is contained in:
56
API.modelmessage.md
Normal file
56
API.modelmessage.md
Normal file
@@ -0,0 +1,56 @@
|
||||
# modelmessage
|
||||
|
||||
This document is auto-generated from the JSDoc comments in `src/store` by running `npm run api-doc`.
|
||||
|
||||
## `modelmessage.add`
|
||||
|
||||
*Source: `src/store/modelmessage/add.js`*
|
||||
|
||||
Appends a message to one of the user's own conversations. `user` messages are refused unless the conversation state is `idle`; other roles ('assistant', 'system', 'tool', 'reasoning') touch `updated_at` unconditionally.
|
||||
|
||||
**Parameters**
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| `googleAuthId` | `number` | The id of the Google auth user. |
|
||||
| `conversationId` | `number` | The conversation id. |
|
||||
| `input` | `object` | Message input. |
|
||||
| `input.message` | `string` | Message text. |
|
||||
| `[input.role='user']` | `'user'|'assistant'|'system'|'tool'|'reasoning'` | Message role. |
|
||||
| `[tx]` | `object` | Optional transaction to run within. |
|
||||
|
||||
**Returns**
|
||||
|
||||
`Promise<{id: number, conversation_id: number, created_at: string, role: string, message: string}>`
|
||||
|
||||
**Throws**
|
||||
|
||||
`Error` — 'Conversation not found', 'Conversation is not idle', 'Message required', 'Invalid role'.
|
||||
|
||||
## `modelmessage.list`
|
||||
|
||||
*Source: `src/store/modelmessage/list.js`*
|
||||
|
||||
Lists messages of one of the user's own conversations, oldest first.
|
||||
|
||||
**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<Array<{id: number, conversation_id: number, created_at: string, role: string, message: string}>>`
|
||||
|
||||
**Throws**
|
||||
|
||||
`Error` — 'Conversation not found' if missing or owned by another user.
|
||||
|
||||
**Example**
|
||||
|
||||
```js
|
||||
const messages = await store.modelmessage.list(42, 7);
|
||||
```
|
||||
Reference in New Issue
Block a user