@theoremjs/react 0.3.5-next.988.gb2d8ffd → 0.3.5-next.989.g88dcbfc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/package.json +3 -3
- package/ui/ChatTranscript.js +15 -1
package/README.md
CHANGED
|
@@ -241,6 +241,8 @@ A tool can also return a **reference**: `{ type, mimeType, uri }`, such as a `gs
|
|
|
241
241
|
|
|
242
242
|
`resolveMedia` returns a string, `null`, or a promise of either. While it works, and when it returns `null` or throws, the chat shows the file name from the `uri`. `TheoremHost` takes the same `resolveMedia`, and always shows all the media of a call.
|
|
243
243
|
|
|
244
|
+
A file the person sent works the same way after your app saves it. When you load a saved conversation, give the person's file as a `user-attachment` or `user-voice` block with `uri` and `type` in place of `data`, and your own values for the file in `metadata` if you need them. The chat shows it on the person's side through `resolveMedia`: a picture, a voice note to play, or the file name.
|
|
245
|
+
|
|
244
246
|
### Resume a conversation
|
|
245
247
|
|
|
246
248
|
The server keeps the conversation in its `conversationStore`. The browser never sends the history. It holds only a ref that the store issued.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theoremjs/react",
|
|
3
|
-
"version": "0.3.5-next.
|
|
3
|
+
"version": "0.3.5-next.989.g88dcbfc",
|
|
4
4
|
"description": "React bindings for Theorem: headless hooks + transport, an Astryx chat UI, and a Web-standard server handler.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"@stylexjs/stylex": "0.19.0",
|
|
61
61
|
"react": "^19.0.0",
|
|
62
62
|
"react-dom": "^19.0.0",
|
|
63
|
-
"@theoremjs/agents": "^0.3.5-next.
|
|
64
|
-
"@theoremjs/web": "^0.3.5-next.
|
|
63
|
+
"@theoremjs/agents": "^0.3.5-next.989.g88dcbfc",
|
|
64
|
+
"@theoremjs/web": "^0.3.5-next.989.g88dcbfc"
|
|
65
65
|
},
|
|
66
66
|
"peerDependenciesMeta": {
|
|
67
67
|
"@astryxdesign/core": {
|
package/ui/ChatTranscript.js
CHANGED
|
@@ -199,7 +199,21 @@ function UserBlock({ block, metadata }) {
|
|
|
199
199
|
}
|
|
200
200
|
/** An attached image or voice note inline; any other file as a Token. */
|
|
201
201
|
function UserFile({ block }) {
|
|
202
|
-
|
|
202
|
+
if (block.uri !== undefined)
|
|
203
|
+
return _jsx(SavedUserFile, { block: block, uri: block.uri });
|
|
204
|
+
return _jsx(UserFileView, { block: block, src: dataUrl(block.mimeType, block.data) });
|
|
205
|
+
}
|
|
206
|
+
/** A file the app saved, as its resolver shows it; the named file while it resolves, or when nothing does. */
|
|
207
|
+
function SavedUserFile({ block, uri }) {
|
|
208
|
+
const src = useResolvedMedia({
|
|
209
|
+
type: block.type ?? (block.kind === 'user-voice' ? 'audio' : 'document'),
|
|
210
|
+
mimeType: block.mimeType,
|
|
211
|
+
uri,
|
|
212
|
+
...(block.metadata ? { metadata: block.metadata } : {}),
|
|
213
|
+
});
|
|
214
|
+
return _jsx(UserFileView, { block: block, src: src ?? undefined });
|
|
215
|
+
}
|
|
216
|
+
function UserFileView({ block, src }) {
|
|
203
217
|
if (src && block.mimeType.startsWith('image/')) {
|
|
204
218
|
return _jsx(ImageAttachment, { src: src, name: block.name });
|
|
205
219
|
}
|