@yeaft/webchat-agent 1.0.340 → 1.0.341
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/local-runtime/server/db/connection.js +3 -0
- package/local-runtime/server/db/yeaft-project-db.js +24 -0
- package/local-runtime/server/handlers/client-conversation.js +1 -0
- package/local-runtime/version.json +1 -1
- package/local-runtime/web/app.bundle.js +110 -101
- package/local-runtime/web/app.bundle.js.gz +0 -0
- package/local-runtime/web/index.html +2 -2
- package/local-runtime/web/style.bundle.css +1 -1
- package/local-runtime/web/style.bundle.css.gz +0 -0
- package/package.json +1 -1
- package/yeaft/projects/store.js +15 -0
- package/yeaft/web-bridge.js +2 -0
|
@@ -702,6 +702,9 @@ export const stmts = {
|
|
|
702
702
|
updateYeaftProjectInstruction: db.prepare(`
|
|
703
703
|
UPDATE yeaft_projects SET instruction = ?, updated_at = ? WHERE user_id = ? AND id = ?
|
|
704
704
|
`),
|
|
705
|
+
updateYeaftProjectSortOrder: db.prepare(`
|
|
706
|
+
UPDATE yeaft_projects SET sort_order = ?, updated_at = ? WHERE user_id = ? AND id = ?
|
|
707
|
+
`),
|
|
705
708
|
deleteYeaftProject: db.prepare(`
|
|
706
709
|
DELETE FROM yeaft_projects WHERE user_id = ? AND id = ?
|
|
707
710
|
`),
|
|
@@ -138,6 +138,30 @@ export const yeaftProjectDb = {
|
|
|
138
138
|
return { projectId: id };
|
|
139
139
|
},
|
|
140
140
|
|
|
141
|
+
reorder(userId, projectIds) {
|
|
142
|
+
const ownerId = requireUserId(userId);
|
|
143
|
+
const projects = this.list(ownerId);
|
|
144
|
+
const ids = Array.isArray(projectIds)
|
|
145
|
+
? projectIds.map(value => typeof value === 'string' ? value.trim() : '')
|
|
146
|
+
: [];
|
|
147
|
+
const currentIds = new Set(projects.map(project => project.id));
|
|
148
|
+
if (ids.length !== projects.length
|
|
149
|
+
|| ids.some(id => !id || !currentIds.has(id))
|
|
150
|
+
|| new Set(ids).size !== ids.length) {
|
|
151
|
+
throw new YeaftProjectDbError('invalid_project_order', 'Complete Project order is required');
|
|
152
|
+
}
|
|
153
|
+
const now = Date.now();
|
|
154
|
+
transaction(() => {
|
|
155
|
+
ids.forEach((id, index) => {
|
|
156
|
+
const result = stmts.updateYeaftProjectSortOrder.run(index, now, ownerId, id);
|
|
157
|
+
if (result.changes !== 1) {
|
|
158
|
+
throw new YeaftProjectDbError('project_order_changed', 'Project identity changed during reorder');
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
})();
|
|
162
|
+
return this.list(ownerId);
|
|
163
|
+
},
|
|
164
|
+
|
|
141
165
|
moveSession(userId, {
|
|
142
166
|
agentId,
|
|
143
167
|
sessionId,
|
|
@@ -1336,6 +1336,7 @@ export async function handleClientConversation(clientId, client, msg, checkAgent
|
|
|
1336
1336
|
else if (op === 'update_instruction') {
|
|
1337
1337
|
result = yeaftProjectDb.updateInstruction(client.userId, msg.projectId, msg.instruction);
|
|
1338
1338
|
} else if (op === 'delete') result = yeaftProjectDb.delete(client.userId, msg.projectId);
|
|
1339
|
+
else if (op === 'reorder') result = yeaftProjectDb.reorder(client.userId, msg.projectIds);
|
|
1339
1340
|
else if (op === 'move_session') {
|
|
1340
1341
|
const agentId = msg.targetAgentId || msg.agentId;
|
|
1341
1342
|
const sessionId = typeof msg.sessionId === 'string' ? msg.sessionId.trim() : '';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"1.0.
|
|
1
|
+
{"version":"1.0.341"}
|