ai_co_discuss 0.3.33 → 0.3.34
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/schema.sql +24 -19
- package/backend/server.py +27 -2
- package/package.json +1 -1
- package/web/app.js +4176 -4161
- package/web/modern.css +1 -1
- package/web/modern.js +130 -131
package/backend/schema.sql
CHANGED
|
@@ -18,6 +18,11 @@ END;
|
|
|
18
18
|
CREATE TABLE IF NOT EXISTS topic_folders (
|
|
19
19
|
id TEXT PRIMARY KEY, name TEXT NOT NULL, position INTEGER NOT NULL DEFAULT 0
|
|
20
20
|
);
|
|
21
|
+
-- Site-wide preferences of the person managing the site; `last_room` is the room they last opened on any device.
|
|
22
|
+
CREATE TABLE IF NOT EXISTS site_preferences (
|
|
23
|
+
key TEXT PRIMARY KEY,
|
|
24
|
+
value TEXT NOT NULL
|
|
25
|
+
);
|
|
21
26
|
CREATE TABLE IF NOT EXISTS directory_settings (
|
|
22
27
|
id INTEGER PRIMARY KEY CHECK (id=1),
|
|
23
28
|
uncategorized_position INTEGER CHECK (uncategorized_position>=0)
|
|
@@ -1304,22 +1309,22 @@ BEGIN
|
|
|
1304
1309
|
INSERT INTO room_revisions (room_id,revision) SELECT '',(SELECT COALESCE(MAX(revision),0)+1 FROM room_revisions)
|
|
1305
1310
|
WHERE NOT EXISTS (SELECT 1 FROM room_revisions WHERE room_id='');
|
|
1306
1311
|
END;
|
|
1307
|
-
-- The platform once called Gemini is identified as Antigravity (the software); screens still show the nickname Gemini.
|
|
1308
|
-
-- Member names move to the new ID, with any instance suffix (Gemini-2 → Antigravity-2); names inside stored JSON follow.
|
|
1309
|
-
-- Message text keeps what was written. Each statement only touches rows still holding the old ID, so reruns change nothing.
|
|
1310
|
-
UPDATE room_members SET name='Antigravity'||substr(name,7) WHERE name='Gemini' OR name GLOB 'Gemini-*';
|
|
1311
|
-
UPDATE messages SET author='Antigravity'||substr(author,7) WHERE author='Gemini' OR author GLOB 'Gemini-*';
|
|
1312
|
-
UPDATE message_summaries SET author='Antigravity'||substr(author,7) WHERE author='Gemini' OR author GLOB 'Gemini-*';
|
|
1313
|
-
UPDATE message_details SET submitted_by='Antigravity'||substr(submitted_by,7) WHERE submitted_by='Gemini' OR submitted_by GLOB 'Gemini-*';
|
|
1314
|
-
UPDATE attachments SET actor='Antigravity'||substr(actor,7) WHERE actor='Gemini' OR actor GLOB 'Gemini-*';
|
|
1315
|
-
UPDATE topic_settings SET host='Antigravity'||substr(host,7) WHERE host='Gemini' OR host GLOB 'Gemini-*';
|
|
1316
|
-
UPDATE member_descriptions SET name='Antigravity'||substr(name,7) WHERE name='Gemini' OR name GLOB 'Gemini-*';
|
|
1317
|
-
UPDATE member_labels SET name='Antigravity'||substr(name,7) WHERE name='Gemini' OR name GLOB 'Gemini-*';
|
|
1318
|
-
UPDATE scheduler_feedback SET should_be='Antigravity'||substr(should_be,7) WHERE should_be='Gemini' OR should_be GLOB 'Gemini-*';
|
|
1319
|
-
UPDATE scheduler_feedback_cases SET should_be='Antigravity'||substr(should_be,7) WHERE should_be='Gemini' OR should_be GLOB 'Gemini-*';
|
|
1320
|
-
UPDATE review_plans SET reviewer_name='Antigravity'||substr(reviewer_name,7) WHERE reviewer_name='Gemini' OR reviewer_name GLOB 'Gemini-*';
|
|
1321
|
-
UPDATE topic_settings SET experts=replace(replace(experts,'"Gemini"','"Antigravity"'),'"Gemini-','"Antigravity-') WHERE experts LIKE '%"Gemini%';
|
|
1322
|
-
UPDATE free_chain_holds SET names=replace(replace(names,'"Gemini"','"Antigravity"'),'"Gemini-','"Antigravity-') WHERE names LIKE '%"Gemini%';
|
|
1323
|
-
UPDATE room_creations SET request_text=replace(replace(request_text,'"Gemini"','"Antigravity"'),'"Gemini-','"Antigravity-') WHERE request_text LIKE '%"Gemini%';
|
|
1324
|
-
UPDATE session_start_submissions SET request_json=replace(replace(request_json,'"Gemini"','"Antigravity"'),'"Gemini-','"Antigravity-') WHERE request_json LIKE '%"Gemini%';
|
|
1325
|
-
UPDATE scheduler_decision_inputs SET input=replace(replace(input,'"Gemini"','"Antigravity"'),'"Gemini-','"Antigravity-') WHERE input LIKE '%"Gemini%';
|
|
1312
|
+
-- The platform once called Gemini is identified as Antigravity (the software); screens still show the nickname Gemini.
|
|
1313
|
+
-- Member names move to the new ID, with any instance suffix (Gemini-2 → Antigravity-2); names inside stored JSON follow.
|
|
1314
|
+
-- Message text keeps what was written. Each statement only touches rows still holding the old ID, so reruns change nothing.
|
|
1315
|
+
UPDATE room_members SET name='Antigravity'||substr(name,7) WHERE name='Gemini' OR name GLOB 'Gemini-*';
|
|
1316
|
+
UPDATE messages SET author='Antigravity'||substr(author,7) WHERE author='Gemini' OR author GLOB 'Gemini-*';
|
|
1317
|
+
UPDATE message_summaries SET author='Antigravity'||substr(author,7) WHERE author='Gemini' OR author GLOB 'Gemini-*';
|
|
1318
|
+
UPDATE message_details SET submitted_by='Antigravity'||substr(submitted_by,7) WHERE submitted_by='Gemini' OR submitted_by GLOB 'Gemini-*';
|
|
1319
|
+
UPDATE attachments SET actor='Antigravity'||substr(actor,7) WHERE actor='Gemini' OR actor GLOB 'Gemini-*';
|
|
1320
|
+
UPDATE topic_settings SET host='Antigravity'||substr(host,7) WHERE host='Gemini' OR host GLOB 'Gemini-*';
|
|
1321
|
+
UPDATE member_descriptions SET name='Antigravity'||substr(name,7) WHERE name='Gemini' OR name GLOB 'Gemini-*';
|
|
1322
|
+
UPDATE member_labels SET name='Antigravity'||substr(name,7) WHERE name='Gemini' OR name GLOB 'Gemini-*';
|
|
1323
|
+
UPDATE scheduler_feedback SET should_be='Antigravity'||substr(should_be,7) WHERE should_be='Gemini' OR should_be GLOB 'Gemini-*';
|
|
1324
|
+
UPDATE scheduler_feedback_cases SET should_be='Antigravity'||substr(should_be,7) WHERE should_be='Gemini' OR should_be GLOB 'Gemini-*';
|
|
1325
|
+
UPDATE review_plans SET reviewer_name='Antigravity'||substr(reviewer_name,7) WHERE reviewer_name='Gemini' OR reviewer_name GLOB 'Gemini-*';
|
|
1326
|
+
UPDATE topic_settings SET experts=replace(replace(experts,'"Gemini"','"Antigravity"'),'"Gemini-','"Antigravity-') WHERE experts LIKE '%"Gemini%';
|
|
1327
|
+
UPDATE free_chain_holds SET names=replace(replace(names,'"Gemini"','"Antigravity"'),'"Gemini-','"Antigravity-') WHERE names LIKE '%"Gemini%';
|
|
1328
|
+
UPDATE room_creations SET request_text=replace(replace(request_text,'"Gemini"','"Antigravity"'),'"Gemini-','"Antigravity-') WHERE request_text LIKE '%"Gemini%';
|
|
1329
|
+
UPDATE session_start_submissions SET request_json=replace(replace(request_json,'"Gemini"','"Antigravity"'),'"Gemini-','"Antigravity-') WHERE request_json LIKE '%"Gemini%';
|
|
1330
|
+
UPDATE scheduler_decision_inputs SET input=replace(replace(input,'"Gemini"','"Antigravity"'),'"Gemini-','"Antigravity-') WHERE input LIKE '%"Gemini%';
|
package/backend/server.py
CHANGED
|
@@ -678,6 +678,23 @@ def list_rooms(connection, params=None):
|
|
|
678
678
|
**folder_directory(connection)}
|
|
679
679
|
|
|
680
680
|
|
|
681
|
+
def last_room(connection):
|
|
682
|
+
"""The room last opened by the site's manager on any device, or '' when none or it no longer exists."""
|
|
683
|
+
row = connection.execute("""SELECT p.value FROM site_preferences p JOIN rooms r ON r.id=p.value
|
|
684
|
+
WHERE p.key='last_room'""").fetchone()
|
|
685
|
+
return row[0] if row else ""
|
|
686
|
+
|
|
687
|
+
|
|
688
|
+
def remember_last_room(connection, payload):
|
|
689
|
+
"""Remember the room the manager opened, so the next visit from any device reopens it."""
|
|
690
|
+
room_id = payload.get("room_id")
|
|
691
|
+
if not isinstance(room_id, str) or not connection.execute("SELECT 1 FROM rooms WHERE id=?", (room_id,)).fetchone():
|
|
692
|
+
raise LookupError("房间不存在")
|
|
693
|
+
connection.execute("INSERT INTO site_preferences (key,value) VALUES ('last_room',?) "
|
|
694
|
+
"ON CONFLICT(key) DO UPDATE SET value=excluded.value", (room_id,))
|
|
695
|
+
return {"last_room": room_id}
|
|
696
|
+
|
|
697
|
+
|
|
681
698
|
def folder_directory(connection):
|
|
682
699
|
"""Return real folders and the virtual group's index (null keeps it last)."""
|
|
683
700
|
settings = connection.execute("SELECT uncategorized_position FROM directory_settings WHERE id=1").fetchone()
|
|
@@ -1564,8 +1581,9 @@ class DiscussionHandler(BaseHTTPRequestHandler):
|
|
|
1564
1581
|
action = (getattr(self, "payload_cache", None) or {}).get("action")
|
|
1565
1582
|
# Timeline segments are read by the timeline page on its own schedule, so they wake no other page.
|
|
1566
1583
|
quiet_renewal = parts[3:4] == ["executions"] and action in ("renew", "segments")
|
|
1584
|
+
# Remembering the opened room changes nothing another page shows, so it wakes none of them.
|
|
1567
1585
|
if (self.command == "POST" and 200 <= status < 300 and parts[:2] in (["api", "rooms"], ["api", "folders"])
|
|
1568
|
-
and not quiet_renewal):
|
|
1586
|
+
and not quiet_renewal and parts != ["api", "rooms", "last"]):
|
|
1569
1587
|
self.server.hub.notify_update(parts[2] if parts[:2] == ["api", "rooms"] and len(parts) > 3 else None)
|
|
1570
1588
|
if content_type == "application/json":
|
|
1571
1589
|
body = json.dumps(body, ensure_ascii=False)
|
|
@@ -1945,10 +1963,17 @@ class DiscussionHandler(BaseHTTPRequestHandler):
|
|
|
1945
1963
|
return self.respond(room_revisions(connection, params))
|
|
1946
1964
|
if parts == ["api", "rooms"]:
|
|
1947
1965
|
if method == "GET":
|
|
1948
|
-
return self.respond({**list_rooms(connection, params), "participants": PARTICIPANTS})
|
|
1966
|
+
return self.respond({**list_rooms(connection, params), "participants": PARTICIPANTS, "last_room": last_room(connection)})
|
|
1949
1967
|
room = create_room(connection, self.read_payload(), self.headers.get("X-Discussion-Token", ""))
|
|
1950
1968
|
connection.commit()
|
|
1951
1969
|
return self.respond(room, 200 if room["duplicate"] else 201)
|
|
1970
|
+
if parts == ["api", "rooms", "last"] and method == "POST":
|
|
1971
|
+
# Only the manager (this computer's page, a relayed device or a signed-in administrator) moves it.
|
|
1972
|
+
if not (self.bridged or self.admin_session(connection)):
|
|
1973
|
+
raise PermissionError("需要管理员身份")
|
|
1974
|
+
result = remember_last_room(connection, self.read_payload())
|
|
1975
|
+
connection.commit()
|
|
1976
|
+
return self.respond(result)
|
|
1952
1977
|
if parts == ["api", "rooms", "import"] and method == "POST":
|
|
1953
1978
|
result = import_room(connection, self.read_payload(MAX_IMPORT_BYTES), self.headers.get("X-Discussion-Token", ""))
|
|
1954
1979
|
connection.commit()
|