57 lines
1.9 KiB
Markdown
57 lines
1.9 KiB
Markdown
# Threads and conversation model
|
|
|
|
Thread-related behavior is implemented in [`chat-ui-3/src-tauri/src/extensions/commands.rs`](../../src-tauri/src/extensions/commands.rs:974).
|
|
|
|
### 9.1 General host threads
|
|
|
|
Use:
|
|
|
|
- [`extension_new_thread()`](../../src-tauri/src/extensions/commands.rs:1173)
|
|
- [`extension_get_thread_list()`](../../src-tauri/src/extensions/commands.rs:974)
|
|
- [`extension_get_full_thread_object()`](../../src-tauri/src/extensions/commands.rs:1152)
|
|
- [`extension_update_thread()`](../../src-tauri/src/extensions/commands.rs:1207)
|
|
|
|
These represent host-owned chat threads.
|
|
|
|
### 9.2 Extension-scoped threads
|
|
|
|
Use:
|
|
|
|
- [`extension_create_extension_thread()`](../../src-tauri/src/extensions/commands.rs:1111)
|
|
- [`extension_list_extension_threads()`](../../src-tauri/src/extensions/commands.rs:1064)
|
|
|
|
Extension-scoped threads require `extensionContext`.
|
|
The browser host adds the frozen `workspaceId`, `groupId`, and calling
|
|
`extensionId` to that context. Values supplied by iframe code for those fields
|
|
are ignored. Listing and deletion therefore match only threads in the same
|
|
extension launch scope.
|
|
|
|
### 9.3 Required `extensionContext` fields
|
|
|
|
Validated by [`ensure_extension_thread_context_defaults()`](../../src-tauri/src/extensions/commands.rs:1612):
|
|
|
|
- `appName`
|
|
- `threadKind`
|
|
- `entityType`
|
|
- `entityId`
|
|
|
|
Host-controlled:
|
|
|
|
- `extensionId`
|
|
- `workspaceId`
|
|
- `groupId`
|
|
|
|
Optional:
|
|
|
|
- `hiddenFromMainThreadList`
|
|
|
|
`hiddenFromMainThreadList` defaults to `true` in [`ensure_extension_thread_context_defaults()`](../../src-tauri/src/extensions/commands.rs:1675).
|
|
|
|
### 9.4 Hidden extension threads
|
|
|
|
General thread listing excludes hidden extension threads using [`is_hidden_extension_thread()`](../../src-tauri/src/extensions/commands.rs:1593).
|
|
|
|
### 9.5 Returned thread identifiers
|
|
|
|
Serialized thread responses include `threadId` through [`serialize_thread_with_flat_id()`](../../src-tauri/src/extensions/commands.rs:1714).
|