agentgui 1.0.756 → 1.0.757
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/lib/ws-handlers-conv.js +16 -0
- package/package.json +1 -1
package/lib/ws-handlers-conv.js
CHANGED
|
@@ -143,6 +143,22 @@ export function register(router, deps) {
|
|
|
143
143
|
return { markdown: md, title: conv.title };
|
|
144
144
|
});
|
|
145
145
|
|
|
146
|
+
router.handle('conv.import', (p) => {
|
|
147
|
+
if (!p.conversation || !p.messages) throw Object.assign(new Error('Missing conversation or messages'), { code: 400 });
|
|
148
|
+
const src = p.conversation;
|
|
149
|
+
const conv = queries.createConversation(
|
|
150
|
+
src.agentId || src.agentType || 'claude-code',
|
|
151
|
+
src.title || 'Imported Conversation',
|
|
152
|
+
src.workingDirectory || null,
|
|
153
|
+
src.model || null
|
|
154
|
+
);
|
|
155
|
+
for (const msg of p.messages) {
|
|
156
|
+
queries.createMessage(conv.id, msg.role || 'user', msg.content || '');
|
|
157
|
+
}
|
|
158
|
+
broadcastSync({ type: 'conversation_created', conversation: queries.getConversation(conv.id) });
|
|
159
|
+
return { conversation: queries.getConversation(conv.id), importedMessages: p.messages.length };
|
|
160
|
+
});
|
|
161
|
+
|
|
146
162
|
router.handle('conv.sync', (p) => {
|
|
147
163
|
const conv = queries.getConversation(p.id);
|
|
148
164
|
if (!conv) notFound();
|