ai_co_discuss 0.4.20 → 0.4.21

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/backend/server.py CHANGED
@@ -729,12 +729,15 @@ def list_rooms(connection, params=None):
729
729
  where = "WHERE EXISTS (SELECT 1 FROM room_creations WHERE room_id=rooms.id AND submission_id=?)" if identifier else ""
730
730
  rows = connection.execute(f"""SELECT rooms.*,
731
731
  COALESCE(stats.message_count,0) AS message_count,COALESCE(stats.latest_id,0) AS latest_id,
732
- (SELECT created_at FROM messages WHERE id=stats.latest_id) AS latest_at
732
+ (SELECT created_at FROM messages WHERE id=stats.latest_id) AS latest_at,
733
+ EXISTS (SELECT 1 FROM member_executions e WHERE e.room_id=rooms.id
734
+ AND e.status IN ('dispatched','started') AND e.lease_until>?) AS running
733
735
  FROM rooms LEFT JOIN room_message_stats stats ON stats.room_id=rooms.id {where}
734
- GROUP BY rooms.id ORDER BY rooms.created_at, rooms.id""", (identifier,) if identifier else ())
736
+ GROUP BY rooms.id ORDER BY rooms.created_at, rooms.id""", (int(time.time()), *((identifier,) if identifier else ())))
735
737
  directory = {row["room_id"]: dict(row) for row in connection.execute("SELECT * FROM room_directory")}
736
738
  assignments = {row["room_id"]: row["folder_id"] for row in connection.execute("SELECT room_id,folder_id FROM room_folder_assignments")}
737
- rooms = [{**dict(row), "archived": bool(directory[row["id"]]["archived"]), "folder_id": assignments[row["id"]]} for row in rows]
739
+ rooms = [{**dict(row), "archived": bool(directory[row["id"]]["archived"]), "running": bool(row["running"]),
740
+ "folder_id": assignments[row["id"]]} for row in rows]
738
741
  return {"rooms": sorted(rooms, key=lambda room: directory[room["id"]]["position"]),
739
742
  **folder_directory(connection)}
740
743
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai_co_discuss",
3
- "version": "0.4.20",
3
+ "version": "0.4.21",
4
4
  "bin": {
5
5
  "codiscuss": "runner/codiscuss.mjs"
6
6
  },
package/web/app.js CHANGED
@@ -1685,6 +1685,20 @@ async function delete_queued(id) {
1685
1685
  await queue_request({ action: "delete", id });
1686
1686
  }
1687
1687
 
1688
+ /**
1689
+ * Send a queued message now. The row leaves the tray at once (QueuedMessages hides it) and the message shows as a
1690
+ * sending card until the refreshed transcript carries it; a refusal brings the row back with the reason.
1691
+ */
1692
+ async function send_queued(id) {
1693
+ const item = state.room?.free?.queued_messages?.items?.find(entry => entry.id === id);
1694
+ // A send from the composer already owns the sending card; this one then just waits in its row.
1695
+ const preview = item && !state.sending_preview
1696
+ ? { author: "用户", text: item.text, created_at: new Date().toISOString(), files: item.attachments.map(file => file.file_name) } : null;
1697
+ if (preview) { state.sending_preview = preview; publish_view(); }
1698
+ try { await queue_request({ action: "send", id }); }
1699
+ finally { if (preview && state.sending_preview === preview) { state.sending_preview = null; publish_view(); } }
1700
+ }
1701
+
1688
1702
  /**
1689
1703
  * The message being edited left the queue (sent or deleted elsewhere): stop editing so sending works again,
1690
1704
  * keeping the edited text in the composer as an ordinary draft.
@@ -5195,7 +5209,7 @@ async function execute_view_action(name, value) {
5195
5209
  load_room_configuration, save_room_configuration, interrupt_member, retry_delivery, retract_message, retract_latest, stop_room, stop_host_checkin, rewind_and_send, fork_room, change_member, reorder_speakers, invite_member,
5196
5210
  enable_room_workflow, move_workflow_members, sync_room_workflow, set_room_host_workflows,
5197
5211
  adopt_recommendation, rate_decision,
5198
- queue_send: id => queue_request({ action: "send", id }), queue_delete: delete_queued,
5212
+ queue_send: send_queued, queue_delete: delete_queued,
5199
5213
  queue_reorder: ids => queue_request({ action: "reorder", ids }), queue_resume: () => queue_request({ action: "resume" }),
5200
5214
  queue_toggle: enabled => queue_request({ action: "queueing", enabled }), queue_edit: edit_queued, queue_cancel_edit: cancel_queued_edit,
5201
5215
  busy: () => { throw new Error("上一个操作仍在处理中,请稍候;长时间无响应请刷新页面"); },