ai_co_discuss 0.3.15 → 0.3.17

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.
Files changed (37) hide show
  1. package/backend/free_room.py +14 -6
  2. package/backend/server.py +5 -0
  3. package/docs/THIRD_PARTY_NOTICES.md +1264 -1264
  4. package/docs/en/workflow.md +1 -1
  5. package/docs/workflow.md +1 -1
  6. package/package.json +1 -1
  7. package/runner/discussion_service.mjs +17 -7
  8. package/runner/free_runner.mjs +2 -2
  9. package/runner/remote_launch.mjs +4 -3
  10. package/runner/scheduler.mjs +7 -4
  11. package/web/app.js +46 -11
  12. package/web/index.html +3 -0
  13. package/web/katex/LICENSE +21 -0
  14. package/web/katex/fonts/KaTeX_AMS-Regular.woff2 +0 -0
  15. package/web/katex/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
  16. package/web/katex/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
  17. package/web/katex/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
  18. package/web/katex/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
  19. package/web/katex/fonts/KaTeX_Main-Bold.woff2 +0 -0
  20. package/web/katex/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
  21. package/web/katex/fonts/KaTeX_Main-Italic.woff2 +0 -0
  22. package/web/katex/fonts/KaTeX_Main-Regular.woff2 +0 -0
  23. package/web/katex/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
  24. package/web/katex/fonts/KaTeX_Math-Italic.woff2 +0 -0
  25. package/web/katex/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
  26. package/web/katex/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
  27. package/web/katex/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
  28. package/web/katex/fonts/KaTeX_Script-Regular.woff2 +0 -0
  29. package/web/katex/fonts/KaTeX_Size1-Regular.woff2 +0 -0
  30. package/web/katex/fonts/KaTeX_Size2-Regular.woff2 +0 -0
  31. package/web/katex/fonts/KaTeX_Size3-Regular.woff2 +0 -0
  32. package/web/katex/fonts/KaTeX_Size4-Regular.woff2 +0 -0
  33. package/web/katex/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
  34. package/web/katex/katex.min.css +1 -0
  35. package/web/markdown.css +1 -1
  36. package/web/modern.css +1 -1
  37. package/web/modern.js +1228 -1231
@@ -1709,7 +1709,8 @@ def route_group(connection, room_id, group, payload):
1709
1709
 
1710
1710
 
1711
1711
  def route_wide(connection, room_id, message_id, payload):
1712
- """Smart scheduling answers an unnamed message with everyone (each member once, as if the user named them all) or no one.
1712
+ """Smart scheduling answers an unnamed message with everyone (each member once, as if the user named them all, at once
1713
+ or one after another), the few members it names, or no one.
1713
1714
 
1714
1715
  A message naming everyone (a group request) is answered by all at once or, with action sequential, one after another.
1715
1716
  Only a host request that has not started changes; a started host already handles the message its own way.
@@ -1725,16 +1726,23 @@ def route_wide(connection, room_id, message_id, payload):
1725
1726
  ORDER BY id DESC LIMIT 1""", (room_id, message_id)).fetchone()
1726
1727
  if group:
1727
1728
  return route_group(connection, room_id, group, payload)
1728
- if action in ("sequential", "host"):
1729
- raise ValueError("只有请全体成员回应的消息可以依次回答或交回主持人")
1730
- if action not in ("all", "none", "some"):
1731
- raise ValueError("未点名消息只能选 action=all、some 或 none")
1729
+ if action == "host":
1730
+ raise ValueError("只有请全体成员回应的消息可以交回主持人")
1731
+ if action not in ("all", "sequential", "none", "some"):
1732
+ raise ValueError("未点名消息只能选 action=all、sequential、some 或 none")
1732
1733
  route = host_route_request(connection, message_id)
1733
1734
  if not route or route["room_id"] != room_id:
1734
1735
  raise LookupError("只能处理交给主持人的未点名消息")
1735
1736
  if route["status"] != "pending":
1736
1737
  raise FileExistsError("主持人已开始处理这条消息,不再改派")
1737
- if action == "none":
1738
+ if action == "sequential":
1739
+ # Same as a group answered one after another: the host's request gives way to the queue, which includes the host.
1740
+ connection.execute("DELETE FROM member_requests WHERE id=?", (route["id"],))
1741
+ members = connection.execute(f"SELECT id FROM room_members WHERE room_id=? AND status='active' AND {REGISTERED_MEMBER}", (room_id,))
1742
+ queue_in_turn(connection, room_id, message_id, [row["id"] for row in members])
1743
+ connection.execute("INSERT INTO group_routes (message_id,room_id,request_id,action) VALUES (?,?,?,?)",
1744
+ (message_id, room_id, route["id"], action))
1745
+ elif action == "none":
1738
1746
  record_cancel_reasons(connection, "id=?", (route["id"],), "no_reply")
1739
1747
  connection.execute("UPDATE member_requests SET status='cancelled' WHERE id=?", (route["id"],))
1740
1748
  elif action == "some":
package/backend/server.py CHANGED
@@ -89,6 +89,11 @@ ASSETS.update({"/pdfjs/" + file.relative_to(WEB_ROOT / "pdfjs").as_posix():
89
89
  (file.relative_to(WEB_ROOT).as_posix(),
90
90
  {".mjs": "text/javascript", ".js": "text/javascript", ".wasm": "application/wasm"}.get(file.suffix, "application/octet-stream"))
91
91
  for file in (WEB_ROOT / "pdfjs").rglob("*") if file.is_file()})
92
+ # KaTeX's stylesheet and the fonts it loads only when a formula is shown.
93
+ ASSETS.update({"/katex/" + file.relative_to(WEB_ROOT / "katex").as_posix():
94
+ (file.relative_to(WEB_ROOT).as_posix(),
95
+ {".css": "text/css", ".woff2": "font/woff2"}.get(file.suffix, "text/plain"))
96
+ for file in (WEB_ROOT / "katex").rglob("*") if file.is_file()})
92
97
  SCHEMA = (Path(__file__).resolve().parent / "schema.sql").read_text(encoding="utf-8")
93
98
  PHASES = {"preparing": "准备中", "initial": "独立观点", "discussing": "深入讨论",
94
99
  "paused": "已暂停", "concluded": "已收束"}