ai_co_discuss 0.4.74 → 0.4.76
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/.agents/skills/discuss-host/references/relay.md +2 -2
- package/.agents/skills/discuss-host/references/room.md +1 -1
- package/.agents/skills/local-stt-setup/SKILL.md +2 -2
- package/.agents/skills/local-tts-setup/SKILL.md +1 -1
- package/backend/free_room.py +16 -5
- package/backend/server.py +1 -1
- package/docs/en/workflow.md +2 -0
- package/docs/runner.md +1 -1
- package/docs/workflow.md +2 -0
- package/frontend/locales/en/backend.json +2 -2
- package/frontend/locales/en/core.json +4 -3
- package/frontend/locales/en/discussion.json +5 -0
- package/frontend/locales/en/room.json +0 -4
- package/gateway/gateway.mjs +5 -18
- package/gateway/login_page.mjs +152 -0
- package/package.json +1 -1
- package/runner/adapters/api.mjs +1 -1
- package/runner/discuss.py +1 -3
- package/runner/local_speech_service.mjs +3 -2
- package/runner/tts_providers.mjs +3 -3
- package/web/app.js +7 -0
- package/web/i18n.js +2 -2
- package/web/modern.css +1 -1
- package/web/modern.js +59 -59
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
| 中途由你把关一稿,或只让中间一段循环 | `--checkpoint 成员` / `--repeat 成员=起点成员` |
|
|
10
10
|
| 用户作为一棒亲自参与或拍板 | `--wait-user 成员` 或 `成员=起点成员` |
|
|
11
11
|
| 一棒里有几位互不依赖、可同时做 | 第一位 `--to`,其余紧跟 `--with` |
|
|
12
|
-
|
|
|
12
|
+
| 某位在后台做、不必等它(如记账、归档) | `--detach 成员`,可单独用,也可随派活 |
|
|
13
13
|
| 派活后你自己还要接着做、不等成员 | `--keep-working` |
|
|
14
14
|
|
|
15
15
|
`sequence view ROOM ID` 可读本圈各棒原文。
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
**同一棒几位**(如 `--to 写手 --to 评审甲 --with 评审乙 --sequential --loop`):这一棒的成员同时开工,全部结束才交下一棒,下一棒能读到每一份回答;组里有人失败,接力停下交回你,用户重试失败的那位后接着走。程序不保证同一棒的成员彼此看不到(后交的人可能读到先交的);需要各自独立判断时,在正文里要求先写完再读别人的,并分清各自管什么。
|
|
22
22
|
|
|
23
|
-
**后台成员** `--detach 成员`(可重复,不能与 `--to`
|
|
23
|
+
**后台成员** `--detach 成员`(可重复,不能与 `--to` 重名):后台派活的唯一写法。它不占住房间(用户发消息不排队),交回你或交下一棒都不等它;做完不交回你,结果在房间里可读,失败时程序通知你。可单独用(不带 `--to`,不算一轮),也可随一次派活同时开工;用在依次接力上时只随第一棒开工一次;撤回这次派活会一并撤回它。
|
|
24
24
|
|
|
25
25
|
**自己接着做** `--keep-working`(API 不提供):这条回答收为派活卡,本轮不要结束,直接接着工作,房间为后续工作另起一张卡;做完照常用本次凭据 `message post` 回答(可再派活)。派出的工作结束时以一条通知交回你,在你这次回答之后送达。不要先回答“我接着做”再结束本轮(后面的工作在房间里就看不到了)。不能与 `--continue`、`--sequential`、`--next-review` 同用。
|
|
26
26
|
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
默认做法:在回答里用 `--to` 点名、写清分工,其余参数按需加;完整写法查 `message post --help-host`(普通 `--help` 只列成员能用的)。
|
|
29
29
|
|
|
30
30
|
- 需要他人时加 `--to 显示名`(可重复,不能点名自己),写明各自负责的文件或模块;不需要他人时不加,本次即结束。派活正文要能独立看懂:直接写要做的事、材料编号与完成标准,不写“同上”“见前文”。
|
|
31
|
-
- 派出的工作无论点名几位,全部结束(含失败)后都交回你。只点名一位、它的回答足以直接给用户(简单问答、无需验收)时可加 `--no-handoff`(API 为 `no_handoff: true
|
|
31
|
+
- 派出的工作无论点名几位,全部结束(含失败)后都交回你。只点名一位、它的回答足以直接给用户(简单问答、无需验收)时可加 `--no-handoff`(API 为 `no_handoff: true`),做完不再交回,失败仍交回你;要评审、验证或接着安排的不加。它仍占住房间(用户发消息要排队),不是后台;要后台做、不等它,用 `--detach`(见 [接力](relay.md)“后台成员”)。
|
|
32
32
|
- 本次执行不便接着做、但还要继续时(等成员的结果之外还要复查、分几步推进),加 `--continue 继续做什么`(API 为 `continue`):房间没有其他进行中的工作时,程序再唤醒你一次;“进行中的工作”包括不交回你的成员(`--no-handoff`、`--detach` 派出的),它们做完之前不会唤醒你。派活后要自己马上接着做、不等它们,用 `--keep-working`(见 [接力](relay.md))。你下次回答不带它、或用户发了新消息就取消,仍需要就重新带上。不要用它等用户回复(需要用户决定时见参与技能 [回答房间请求](../../discuss-participant/references/room.md)“需要用户决定时”);Goal 进行中由 Goal 负责空闲续跑,不必加。
|
|
33
33
|
|
|
34
34
|
### 轮数上限
|
|
@@ -9,7 +9,7 @@ description: "为 AI CoDiscuss 安装本机语音识别:下载 CrispASR 与 Qw
|
|
|
9
9
|
|
|
10
10
|
- `SERVICE_HOME/crispasr/cli/`:CrispASR 程序(`crispasr.exe` 及其 DLL);`SERVICE_HOME/crispasr/models/qwen3-asr-0.6b-q8_0.gguf`:识别模型(约 1 GB)。`SERVICE_HOME` 见“前提”第 2 条。
|
|
11
11
|
- 访问令牌存在 CoDiscuss 的本机私有密钥里(地址 `http://127.0.0.1/crispasr`,只用来标识本机识别服务,不含端口),不写进其他文件或命令行。
|
|
12
|
-
- 语音输入切到“本机”。CrispASR 由 CoDiscuss 本机程序在识别时自动启动,只监听本机地址,优先用端口 37642,被占用时自动换一个空闲端口;
|
|
12
|
+
- 语音输入切到“本机”。CrispASR 由 CoDiscuss 本机程序在识别时自动启动,只监听本机地址,优先用端口 37642,被占用时自动换一个空闲端口;5 分钟没有识别请求自动结束并释放显存(CoDiscuss 崩溃也一样),不需要开机自启。
|
|
13
13
|
|
|
14
14
|
全程只在用户电脑上操作:不改 CoDiscuss 源码,不把令牌写进回复、日志或命令行参数;下载与安装前把预计占用(下文“前提”)告诉用户。
|
|
15
15
|
|
|
@@ -31,7 +31,7 @@ description: "为 AI CoDiscuss 安装本机语音识别:下载 CrispASR 与 Qw
|
|
|
31
31
|
| Linux x64 | NVIDIA / 其他独显 / 无 | `crispasr-linux-x86_64-cuda13.tar.gz`(或 `-cuda`)/ `-vulkan.tar.gz` / `crispasr-linux-x86_64.tar.gz` |
|
|
32
32
|
|
|
33
33
|
只能用 CPU 时先告诉用户:识别速度约等于录音时长(一段 1 分钟的话要等约 1 分钟),用户同意再装。
|
|
34
|
-
4. **显存与磁盘**:识别服务运行时约占 2.5 GB 显存;与本机朗读(约 3 GB)同时运行时,8 GB
|
|
34
|
+
4. **显存与磁盘**:识别服务运行时约占 2.5 GB 显存;与本机朗读(约 3 GB)同时运行时,8 GB 显卡余量很紧,两者都是闲置 5 分钟后自动退出。磁盘约 1.7 GB(Windows CUDA 13 程序约 0.7 GB + 模型约 1 GB)。
|
|
35
35
|
|
|
36
36
|
## 安装
|
|
37
37
|
|
|
@@ -9,7 +9,7 @@ description: "为 AI CoDiscuss 安装本机朗读语音:下载 yovoice CLI、
|
|
|
9
9
|
|
|
10
10
|
- `SERVICE_HOME/yovoice/cli/`:yovoice CLI(含 `tools/` 下的音频转换器);`SERVICE_HOME/yovoice/data/`:推理引擎与模型,只给 CoDiscuss 用,不与 yovoice 桌面应用共用(`SERVICE_HOME` 见“前提”第 2 条)。
|
|
11
11
|
- 访问令牌存在 CoDiscuss 的本机私有密钥里(地址 `http://127.0.0.1/yovoice`,只用来标识本机朗读服务,不含端口),不写进其他文件。
|
|
12
|
-
- 朗读设置切到“本机”。yovoice 服务由 CoDiscuss 本机程序在朗读时自动启动,只监听本机地址,优先用端口 37641
|
|
12
|
+
- 朗读设置切到“本机”。yovoice 服务由 CoDiscuss 本机程序在朗读时自动启动,只监听本机地址,优先用端口 37641,被占用时自动换一个空闲端口;5 分钟没有朗读请求时自动结束并释放显存(CoDiscuss 崩溃也一样),不需要开机自启。
|
|
13
13
|
|
|
14
14
|
全程只在用户电脑上操作:不改 CoDiscuss 源码,不把令牌写进回复、日志或命令行参数;下载与安装前把预计占用(下文“前提”)告诉用户。
|
|
15
15
|
|
package/backend/free_room.py
CHANGED
|
@@ -1344,6 +1344,8 @@ def after_proactive(connection, room_id, message_id, member, payload):
|
|
|
1344
1344
|
elif payload.get("to"):
|
|
1345
1345
|
dispatch(connection, room_id, member, message_id, payload["to"], message_id, payload.get("handoff") is True,
|
|
1346
1346
|
payload.get("no_handoff") is True, {"need": need_plan(payload)}, payload.get("detach"))
|
|
1347
|
+
elif payload.get("detach"):
|
|
1348
|
+
send_detached(connection, room_id, member, message_id, message_id, payload["detach"])
|
|
1347
1349
|
remember_continue(connection, room_id, member, message_id, message_id, payload)
|
|
1348
1350
|
settle_batches(connection, room_id)
|
|
1349
1351
|
|
|
@@ -1863,8 +1865,7 @@ def dispatch(connection, room_id, host, message_id, names, chain_id, handoff=Fal
|
|
|
1863
1865
|
return
|
|
1864
1866
|
for member_id in member_ids:
|
|
1865
1867
|
insert_request(connection, room_id, member_id, message_id, chain_id, "ask", "host", batch_id=message_id)
|
|
1866
|
-
|
|
1867
|
-
insert_request(connection, room_id, member_id, message_id, chain_id, "ask", "host")
|
|
1868
|
+
send_detached(connection, room_id, host, message_id, chain_id, detach)
|
|
1868
1869
|
connection.execute("INSERT INTO free_batches (room_id,batch_id,chain_id,host_id) VALUES (?,?,?,?)",
|
|
1869
1870
|
(room_id, message_id, chain_id, host["id"]))
|
|
1870
1871
|
if plan.get("relay"):
|
|
@@ -1877,6 +1878,14 @@ def dispatch(connection, room_id, host, message_id, names, chain_id, handoff=Fal
|
|
|
1877
1878
|
connection.execute("INSERT INTO free_direct_batches (room_id,batch_id) VALUES (?,?)", (room_id, message_id))
|
|
1878
1879
|
|
|
1879
1880
|
|
|
1881
|
+
def send_detached(connection, room_id, host, message_id, chain_id, detach):
|
|
1882
|
+
"""Start background members (`detach`): outside any batch, so nothing waits for them, the room does not count them as
|
|
1883
|
+
busy and their answer stays in the room; a failure reaches the host like any request outside a batch. Sent alone
|
|
1884
|
+
(without `to`) they use no round: they never hand back, so they cannot carry the chain on."""
|
|
1885
|
+
for member_id in named_members(active_members(connection, room_id), detach or [], exclude=host["name"]):
|
|
1886
|
+
insert_request(connection, room_id, member_id, message_id, chain_id, "ask", "host")
|
|
1887
|
+
|
|
1888
|
+
|
|
1880
1889
|
def settle_batches(connection, room_id):
|
|
1881
1890
|
"""Hand each finished batch back to its host once, a failed one included; a batch that was only stopped halts its chain.
|
|
1882
1891
|
|
|
@@ -2019,7 +2028,7 @@ def checked_sequence(actor, payload):
|
|
|
2019
2028
|
|
|
2020
2029
|
|
|
2021
2030
|
def checked_detach(actor, payload):
|
|
2022
|
-
"""`detach`: members the host sends
|
|
2031
|
+
"""`detach`: members the host sends to work in the background, alone or along with a dispatch; never among those in `to`."""
|
|
2023
2032
|
detach = payload.get("detach")
|
|
2024
2033
|
if detach is None:
|
|
2025
2034
|
return
|
|
@@ -2029,8 +2038,8 @@ def checked_detach(actor, payload):
|
|
|
2029
2038
|
if (not isinstance(detach, list) or not detach or any(not isinstance(name, str) for name in detach)
|
|
2030
2039
|
or len(set(detach)) != len(detach)):
|
|
2031
2040
|
raise ValueError(Text("detach 须为不重复的成员名列表"))
|
|
2032
|
-
if
|
|
2033
|
-
raise ValueError(Text("detach
|
|
2041
|
+
if set(detach) & set(names):
|
|
2042
|
+
raise ValueError(Text("detach 不能包含 to 中的成员"))
|
|
2034
2043
|
|
|
2035
2044
|
|
|
2036
2045
|
def relay_order(names, parallel):
|
|
@@ -2582,6 +2591,8 @@ def after_free_message(connection, room_id, message_id, actor, payload):
|
|
|
2582
2591
|
elif actor["role"] == "host" and payload.get("to"):
|
|
2583
2592
|
dispatch(connection, room_id, actor, message_id, payload["to"], chain_id, payload.get("handoff") is True or bool(payload.get("next_review")),
|
|
2584
2593
|
payload.get("no_handoff") is True, {"need": need_plan(payload)}, payload.get("detach"))
|
|
2594
|
+
elif actor["role"] == "host" and payload.get("detach"):
|
|
2595
|
+
send_detached(connection, room_id, actor, message_id, chain_id, payload["detach"])
|
|
2585
2596
|
if payload.get("keep_working") is True:
|
|
2586
2597
|
keep_working(connection, room_id, actor, message_id, chain_id, payload["execution_id"])
|
|
2587
2598
|
if actor["role"] == "host":
|
package/backend/server.py
CHANGED
|
@@ -2400,7 +2400,7 @@ def protocol_text(room, language="zh"):
|
|
|
2400
2400
|
Text("用户管理和讨论开关使用房主凭据;本地成员使用本人的 --access-file,不借用其他身份。凭据私下交付,不公开 token。API 参与者遵循相同请求与执行约束,source=api;本地 CLI 使用 source=cli。"),
|
|
2401
2401
|
Text("runner 成员等待本机接入程序交付任务,用 execution view 核对本次执行和请求,再以 message post --as 本人 --kind chat --execution 本次编号 --access-file FILE 回答。执行失效后保留草稿,不能去掉编号改作普通发言;认领、续租与后续投递由接入程序处理。"),
|
|
2402
2402
|
Text("manual 本地成员首次用 member register 注册,会话 ID 由 CLI 自动取得;回答用 --request 请求编号,不编造执行编号。讨论不使用原生定时;原会话不能托管时由用户触发。"),
|
|
2403
|
-
Text("房间里的 host 可用 --to 点名成员,route 表示未点名的用户请求,handoff 表示派出任务已结束;链上 AI 派活受房间预算限制。--to 多位并加 --sequential 时按点名顺序依次接力,每棒一轮,最后交回主持人;--with 成员与紧挨在前的 --to 同一棒同时做,这一组全部结束才交下一棒;--detach
|
|
2403
|
+
Text("房间里的 host 可用 --to 点名成员,route 表示未点名的用户请求,handoff 表示派出任务已结束;链上 AI 派活受房间预算限制。--to 多位并加 --sequential 时按点名顺序依次接力,每棒一轮,最后交回主持人;--with 成员与紧挨在前的 --to 同一棒同时做,这一组全部结束才交下一棒;--detach 成员在后台工作:不等它、不交回、也不占住房间,可单独用或随派活同时开工(失败时通知主持人);--keep-working 派活后自己不结束这一轮、接着工作:这条回答收为派活卡,后续工作另起一张卡,做完照常回答(同一执行凭据即可),派出的工作结束时以通知交回;不能与 --continue、--sequential、--next-review 同用;再加 --loop 则交回为检查点,用 sequence continue --request 交接请求编号开始下一圈,不继续即直接验收。普通成员的 --to 或正文 @ 只保存回应建议,不直接唤醒;不点名自己、不扩大授权。"),
|
|
2404
2404
|
Text("讨论中的用户 @ 直接提问独立排队,不计讨论轮次、不与讨论发言合并。initial 阶段先独立判断;服务端按讨论请求的 read_until 限制读取。直接提问和主持任务不继承该阅读限制。"),
|
|
2405
2405
|
Text("主持安排前先 turn roster 读取在场专家、waiting、unregistered 和 revision,再 turn create --roster revision;单项和多项都要带凭据,多项计划须覆盖本轮 waiting。继续排队同样先读 roster,再 turn continue --roster revision。状态或新消息变化后旧凭据被拒绝,重新读取再判断;每个回答保存后由程序推进下一项。"),
|
|
2406
2406
|
Text("局部追问先 turn roster 读取 host_requests 的请求与原消息编号,再 turn ask --request ID --expert NAME --roster revision --submission-id UUID;普通提问不计轮次、不改讨论队列,可问已发言者和主持人,只结束指定请求。"),
|
package/docs/en/workflow.md
CHANGED
|
@@ -4,6 +4,8 @@ English | [简体中文](../workflow.md)
|
|
|
4
4
|
|
|
5
5
|
How collaboration works inside a room. For installation, see [Setup](runner.md).
|
|
6
6
|
|
|
7
|
+
Message cards show each recipient's waiting, delivery, processing, answer or cancellation status. When a recipient is busy, the card says it is waiting for the current run to finish. Answer links locate the reply, including replies that answer several requests together. Queued messages remain in the queue area.
|
|
8
|
+
|
|
7
9
|
> The web UI is currently in Chinese; UI labels are given in parentheses.
|
|
8
10
|
|
|
9
11
|
## Concepts
|
package/docs/runner.md
CHANGED
|
@@ -181,7 +181,7 @@ API 成员可以担任专家或主持人。房间指定了项目目录时,只
|
|
|
181
181
|
|
|
182
182
|
## 朗读与语音输入(可选)
|
|
183
183
|
|
|
184
|
-
朗读可在网页“设置”的“语音”里切换服务:火山引擎(豆包语音合成 2.0)、阿里云百炼(CosyVoice)、Azure(神经语音,另填语音资源所在区域)、OpenAI(gpt-4o-mini-tts,已为模型 API 成员保存过 OpenAI Key 时直接沿用;音色偏英语口音,OpenAI 定于 2027-01-06 停用该接口),或“本机”(在这台电脑的显卡上运行 Qwen3-TTS,不需要密钥、不计费;让你的本地 AI 按 `local-tts-setup` 技能安装,约占 3.5 GB 磁盘、建议 4 GB
|
|
184
|
+
朗读可在网页“设置”的“语音”里切换服务:火山引擎(豆包语音合成 2.0)、阿里云百炼(CosyVoice)、Azure(神经语音,另填语音资源所在区域)、OpenAI(gpt-4o-mini-tts,已为模型 API 成员保存过 OpenAI Key 时直接沿用;音色偏英语口音,OpenAI 定于 2027-01-06 停用该接口),或“本机”(在这台电脑的显卡上运行 Qwen3-TTS,不需要密钥、不计费;让你的本地 AI 按 `local-tts-setup` 技能安装,约占 3.5 GB 磁盘、建议 4 GB 以上显存,不支持调语速;朗读时自动启动,5 分钟没有朗读时自动退出、释放显存)。在所选服务的控制台获取 API Key 填进去;每个服务的 Key 与音色分开保存,切回时仍在。语音输入可另选服务:火山引擎「录音文件识别2.0」或 OpenAI(gpt-transcribe,OpenAI 定于 2027-02-26 停用;两者在朗读用其他服务时各需对应的 Key,OpenAI 已保存过时直接沿用),或“本机”(在这台电脑上运行 Qwen3-ASR,不需要密钥、不计费;让你的本地 AI 按 `local-stt-setup` 技能安装,约占 1.7 GB 磁盘、运行时约 2.5 GB 显存,用时自动启动、闲置 5 分钟退出)。“朗读”和“语音输入”下各有一行“本机进程”,显示本机服务是否在运行(进程名与 PID);运行中时右侧的电源按钮可强行结束它(连同子进程),用于程序异常退出后服务残留、占着显存的情况。朗读可设一个通用音色,并按 AI 平台(Claude、Codex、Gemini 等)分别配音色,朗读项目文件也可单独配一个音色,没配的平台、你自己的消息、程序消息和文件用通用音色;还可选语速;火山引擎、OpenAI 与本机还可改语气提示,各自分开保存(火山引擎默认“像给朋友讲故事一样”的自然语气,本机默认平静克制)。密钥只保存在本机,费用按你的账号计费。
|
|
185
185
|
|
|
186
186
|
- 朗读:每条消息的工具栏有“朗读”(手机上在“…”菜单里),在消息里选中文字后点“听当前”从选中处开始;读完这条会接着读后面的消息直到最新,点输入框右下角的播报按钮开启语音播报:之后的新回复会自动朗读回答摘要(没写摘要的短回答读全文,长回答读第一段),主持人的发言会报“主持人”;讨论中还会提示新一轮的发言顺序和轮到谁,执行失败、操作待你允许和讨论结束也会播一句。同时到达的回复依次播报,积压较多时只播最新 3 条。锁屏或切到其他 App 时继续播放,锁屏界面和耳机按键可以暂停、继续、跳到下一条;读过的段落会缓存在电脑上,重听不再计费。正在读的句子会高亮,点一下高亮的句子暂停,再点继续;代码块跳过。朗读时消息区底部有“跟随”和“退出”:页面默认不随朗读滚动,点“跟随”后才把正在读的句子保持在视野内,手动滚动一下就取消跟随。
|
|
187
187
|
- 朗读文件:在“文件”里打开 Markdown 文件,预览模式下标题栏有“朗读”,从正文开头读到文件末尾(文件头的 `---` 元数据不读);选中文字后可从选中处开始。暂停、跟随、退出与消息朗读相同;收起为悬浮窗时继续朗读,切到源码、换文件或关闭预览(含悬浮窗上的关闭)即停止。
|
package/docs/workflow.md
CHANGED
|
@@ -218,7 +218,7 @@
|
|
|
218
218
|
"delivery 须带布尔值 stoppable 与 progress": "delivery requires boolean stoppable and progress values",
|
|
219
219
|
"denials 须为 1–{max_denials} 条 {open_brace}tool, detail, rule{close_brace}": "denials must contain 1–{max_denials} entries with {open_brace}tool, detail, rule{close_brace}",
|
|
220
220
|
"descriptions 须为 {open_brace}成员名: 描述{close_brace},最多 {max_room_agents} 位,每段最多 {max_member_description} 字": "descriptions must be {open_brace}member name: description{close_brace}, with up to {max_room_agents} members and {max_member_description} characters per description",
|
|
221
|
-
"detach
|
|
221
|
+
"detach 不能包含 to 中的成员": "detach must not include any members listed in to",
|
|
222
222
|
"detach 须为不重复的成员名列表": "detach must be a list of unique member names",
|
|
223
223
|
"edited 须为最多 {max_changed_files} 个相对路径": "edited must contain at most {max_changed_files} relative paths",
|
|
224
224
|
"execution_id 与 request_id 不能同时使用": "execution_id and request_id cannot be used together",
|
|
@@ -682,7 +682,7 @@
|
|
|
682
682
|
"用户管理和讨论开关使用房主凭据;本地成员使用本人的 --access-file,不借用其他身份。凭据私下交付,不公开 token。API 参与者遵循相同请求与执行约束,source=api;本地 CLI 使用 source=cli。": "Use the owner credential for room management and discussion controls. Local members use their own --access-file and never borrow another identity. Deliver credentials privately; do not expose tokens. API participants follow the same request and execution rules with source=api; local CLI participants use source=cli.",
|
|
683
683
|
"runner 成员等待本机接入程序交付任务,用 execution view 核对本次执行和请求,再以 message post --as 本人 --kind chat --execution 本次编号 --access-file FILE 回答。执行失效后保留草稿,不能去掉编号改作普通发言;认领、续租与后续投递由接入程序处理。": "Runner members wait for the local service to deliver tasks, verify the execution and request with execution view, then answer with message post --as YOUR_NAME --kind chat --execution ID --access-file FILE. Keep a draft if an execution becomes invalid; do not remove its ID to post an ordinary message. The local service handles claiming, lease renewal, and delivery.",
|
|
684
684
|
"manual 本地成员首次用 member register 注册,会话 ID 由 CLI 自动取得;回答用 --request 请求编号,不编造执行编号。讨论不使用原生定时;原会话不能托管时由用户触发。": "A manual local member registers once with member register; the CLI supplies its session ID. Answer with --request REQUEST_ID and do not invent an execution ID. Discussions do not use native scheduling; the user triggers work when the original session cannot be hosted.",
|
|
685
|
-
"房间里的 host 可用 --to 点名成员,route 表示未点名的用户请求,handoff 表示派出任务已结束;链上 AI 派活受房间预算限制。--to 多位并加 --sequential 时按点名顺序依次接力,每棒一轮,最后交回主持人;--with 成员与紧挨在前的 --to 同一棒同时做,这一组全部结束才交下一棒;--detach
|
|
685
|
+
"房间里的 host 可用 --to 点名成员,route 表示未点名的用户请求,handoff 表示派出任务已结束;链上 AI 派活受房间预算限制。--to 多位并加 --sequential 时按点名顺序依次接力,每棒一轮,最后交回主持人;--with 成员与紧挨在前的 --to 同一棒同时做,这一组全部结束才交下一棒;--detach 成员在后台工作:不等它、不交回、也不占住房间,可单独用或随派活同时开工(失败时通知主持人);--keep-working 派活后自己不结束这一轮、接着工作:这条回答收为派活卡,后续工作另起一张卡,做完照常回答(同一执行凭据即可),派出的工作结束时以通知交回;不能与 --continue、--sequential、--next-review 同用;再加 --loop 则交回为检查点,用 sequence continue --request 交接请求编号开始下一圈,不继续即直接验收。普通成员的 --to 或正文 @ 只保存回应建议,不直接唤醒;不点名自己、不扩大授权。": "A room host can address members with --to. route means an unaddressed user request; handoff means dispatched work has ended. Chained AI assignments are limited by the room budget. With multiple --to members and --sequential, members work in the named order, one round per step, then return to the host. Members named by --with work alongside the immediately preceding --to in the same step; the next step waits for all of them. Members named by --detach work in the background: not awaited, not handed back and not holding the room; usable alone or alongside an assignment; failures notify the host. With --keep-working, the host continues its current turn after dispatch: its answer becomes the dispatch card, later work gets a new card, and the host answers normally when done using the same execution credential. A notice returns the dispatched work when it ends. This option cannot be combined with --continue, --sequential, or --next-review. Adding --loop returns a checkpoint; use sequence continue --request HANDOFF_REQUEST_ID to start another cycle, or accept the result without continuing. An ordinary member's --to or @ mention only records a suggestion and does not wake anyone. Do not address yourself or expand permissions.",
|
|
686
686
|
"讨论中的用户 @ 直接提问独立排队,不计讨论轮次、不与讨论发言合并。initial 阶段先独立判断;服务端按讨论请求的 read_until 限制读取。直接提问和主持任务不继承该阅读限制。": "A user's @ question during a discussion is queued separately; it does not count as a discussion round or merge with a discussion turn. During the initial phase, experts first form independent opinions. The server enforces each discussion request's read_until boundary. Direct questions and host tasks do not inherit that boundary.",
|
|
687
687
|
"主持安排前先 turn roster 读取在场专家、waiting、unregistered 和 revision,再 turn create --roster revision;单项和多项都要带凭据,多项计划须覆盖本轮 waiting。继续排队同样先读 roster,再 turn continue --roster revision。状态或新消息变化后旧凭据被拒绝,重新读取再判断;每个回答保存后由程序推进下一项。": "Before scheduling, read turn roster for present experts, waiting, unregistered, and revision; then call turn create --roster REVISION. Include the credential for single and multi-turn plans; a multi-turn plan must cover everyone waiting this round. Before continuing the queue, read the roster again and call turn continue --roster REVISION. Stale credentials are rejected after state or message changes; reread before deciding. The program advances after each answer is saved.",
|
|
688
688
|
"局部追问先 turn roster 读取 host_requests 的请求与原消息编号,再 turn ask --request ID --expert NAME --roster revision --submission-id UUID;普通提问不计轮次、不改讨论队列,可问已发言者和主持人,只结束指定请求。": "For a follow-up, first read turn roster for the host_requests and source message IDs, then call turn ask --request ID --expert NAME --roster REVISION --submission-id UUID. A direct question does not count as a round or change the discussion queue. It may go to a previous speaker or the host and closes only the specified request.",
|
|
@@ -301,7 +301,6 @@
|
|
|
301
301
|
"清除搜索": "Clear search",
|
|
302
302
|
"搜索": "Search",
|
|
303
303
|
"筛选消息与卡片": "Filter messages and cards",
|
|
304
|
-
"未完成的创建或启动请求": "Unfinished create or start requests",
|
|
305
304
|
"查看原房间": "Open room",
|
|
306
305
|
"移除待办": "Dismiss",
|
|
307
306
|
"主持简报": "Host brief",
|
|
@@ -330,13 +329,15 @@
|
|
|
330
329
|
"启动结果尚未确认;原请求已保存在此浏览器中。": "The start result isn't confirmed yet; the original request is saved in this browser.",
|
|
331
330
|
"展开房间栏": "Expand room panel",
|
|
332
331
|
"收起房间栏": "Collapse room panel",
|
|
333
|
-
"继续创建房间": "Continue creating room",
|
|
334
332
|
"继续本次启动": "Continue this start",
|
|
335
333
|
"展开主持简报": "Expand host brief",
|
|
336
334
|
"收起主持简报": "Collapse host brief",
|
|
337
335
|
"已启用它的房间会显示“工作流不可用”,成员改用房间里的设置。": "Rooms using it will show “Workflow unavailable”, and members fall back to the room's settings.",
|
|
338
336
|
"房间成员、消息记录和项目文件不受影响。": "Room members, messages and project files are not affected.",
|
|
339
|
-
"
|
|
337
|
+
"查看房间": "Open room",
|
|
338
|
+
"删除记录": "Delete record",
|
|
339
|
+
"结果未确认,点击重试或删除记录": "Result not confirmed; click to retry or delete the record",
|
|
340
|
+
"未确认": "Unconfirmed",
|
|
340
341
|
"移除待办不会删除房间或停止讨论。": "Dismissing doesn't delete the room or stop the discussion.",
|
|
341
342
|
"当前未设置项目目录": "No project folder set",
|
|
342
343
|
"主持人整理的结论、共识与分歧,用 #消息编号 保留依据;讨论结束时保存进下方记录。": "Conclusions, consensus and disagreements gathered by the host, citing #message numbers; saved into the record below when a discussion ends.",
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
+
"已跳过": "Skipped",
|
|
3
|
+
"等待中": "Waiting",
|
|
4
|
+
"等待中:等当前执行结束": "Waiting for the current run to finish",
|
|
5
|
+
"在 #{id} 一并回答": "Answered together in #{id}",
|
|
6
|
+
"查看回答 #{id}": "View answer #{id}",
|
|
2
7
|
"额度已用尽,请等待重置或改派其他成员。": "Usage limit reached. Wait for it to reset or assign another member.",
|
|
3
8
|
"登录已失效,请在本机重新登录后再试。": "Sign-in has expired. Sign in again on this computer before retrying.",
|
|
4
9
|
"输出达到上限,请缩短要求的输出或拆分任务。": "Output limit reached. Request a shorter answer or split the task.",
|
|
@@ -762,10 +762,6 @@
|
|
|
762
762
|
"改动较长,只显示前面一部分": "Long change; only the first part is shown",
|
|
763
763
|
"正在上传附件 {value1}/{value2}…": "Uploading attachments {value1}/{value2}…",
|
|
764
764
|
"正在上传": "Uploading",
|
|
765
|
-
"{value1} 已停止": "{value1} stopped",
|
|
766
|
-
"{name} 的发言已跳过": "{name}'s turn was skipped",
|
|
767
|
-
"{name} {state}:{reason}": "{name} {state}: {reason}",
|
|
768
|
-
"未回答": "no answer",
|
|
769
765
|
"安排 #{value1}": "Arrangement #{value1}",
|
|
770
766
|
"执行 #{value1}": "Run #{value1}"
|
|
771
767
|
}
|
package/gateway/gateway.mjs
CHANGED
|
@@ -18,6 +18,7 @@ import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
|
18
18
|
import { parseArgs } from 'node:util';
|
|
19
19
|
|
|
20
20
|
import { ENTRY_KEY_PATTERN, verified_connection } from '../runner/entry_client.mjs';
|
|
21
|
+
import { login_page } from './login_page.mjs';
|
|
21
22
|
|
|
22
23
|
const SESSION_COOKIE = 'codiscuss_entry';
|
|
23
24
|
const SESSION_SECONDS = 30 * 24 * 3600;
|
|
@@ -321,20 +322,6 @@ function load_sessions(data, at) {
|
|
|
321
322
|
const PAGE_HEAD = title => `<!doctype html><html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
|
322
323
|
<title>${title} · AI CoDiscuss</title>`;
|
|
323
324
|
|
|
324
|
-
function login_page(message = '') {
|
|
325
|
-
const notice = message ? `<p class="error">${message}</p>` : '';
|
|
326
|
-
return `${PAGE_HEAD('登录')}<style>
|
|
327
|
-
body{margin:0;min-height:100vh;display:grid;place-items:center;font:16px system-ui,sans-serif;background:#f5f5f4;color:#1c1917}
|
|
328
|
-
form{width:min(320px,calc(100vw - 48px));display:grid;gap:12px}h1{font-size:20px;margin:0 0 8px}
|
|
329
|
-
input,button{font:inherit;padding:10px 12px;border-radius:8px;border:1px solid #d6d3d1}button{background:#1c1917;color:#fff;border:0}
|
|
330
|
-
.error{color:#b91c1c;margin:0;font-size:14px}
|
|
331
|
-
@media (prefers-color-scheme:dark){body{background:#1c1917;color:#f5f5f4}input{background:#292524;color:inherit;border-color:#44403c}button{background:#f5f5f4;color:#1c1917}}
|
|
332
|
-
</style></head><body><form method="post" action="${LOGIN_PATH}"><h1>AI CoDiscuss</h1>${notice}
|
|
333
|
-
<input name="name" placeholder="账号" autocomplete="username" autocapitalize="none" required>
|
|
334
|
-
<input name="password" type="password" placeholder="密码" autocomplete="current-password" required>
|
|
335
|
-
<button>登录</button></form></body></html>`;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
325
|
/** What a person sees when their instance does not answer: no technical detail, a retry, and whom to ask. */
|
|
339
326
|
function unavailable_page() {
|
|
340
327
|
return `${PAGE_HEAD('暂时打不开')}<style>
|
|
@@ -448,17 +435,17 @@ export function create_gateway({ data, now = Date.now }) {
|
|
|
448
435
|
const form = await read_form(request);
|
|
449
436
|
const name = String(form.get('name') || '').trim().toLowerCase();
|
|
450
437
|
const failed = failures.get(name);
|
|
451
|
-
if (failed && failed.until > now()) return send(response, 429, { 'Content-Type': 'text/html; charset=utf-8' }, login_page('
|
|
438
|
+
if (failed && failed.until > now()) return send(response, 429, { 'Content-Type': 'text/html; charset=utf-8' }, login_page({ action: LOGIN_PATH, refusal: 'locked', name }));
|
|
452
439
|
// One snapshot both checks the password and fixes the session to it: a reset made meanwhile by the panel leaves this
|
|
453
440
|
// session on the old version, so it never grants access.
|
|
454
441
|
const account = NAME_PATTERN.test(name) ? read_accounts(data)[name] : null;
|
|
455
442
|
if (!password_matches(account, form.get('password'))) {
|
|
456
443
|
const count = (failed?.count || 0) + 1;
|
|
457
444
|
if (NAME_PATTERN.test(name)) failures.set(name, { count, until: count >= MAX_FAILURES ? now() + LOCK_MS : 0 });
|
|
458
|
-
return send(response, 401, { 'Content-Type': 'text/html; charset=utf-8' }, login_page('
|
|
445
|
+
return send(response, 401, { 'Content-Type': 'text/html; charset=utf-8' }, login_page({ action: LOGIN_PATH, refusal: 'wrong', name }));
|
|
459
446
|
}
|
|
460
447
|
failures.delete(name);
|
|
461
|
-
if (account.disabled) return send(response, 403, { 'Content-Type': 'text/html; charset=utf-8' }, login_page('
|
|
448
|
+
if (account.disabled) return send(response, 403, { 'Content-Type': 'text/html; charset=utf-8' }, login_page({ action: LOGIN_PATH, refusal: 'disabled', name }));
|
|
462
449
|
const token = randomBytes(32).toString('hex');
|
|
463
450
|
sessions.set(token_key(token), { name, expires: now() + SESSION_SECONDS * 1000, hash: account.hash, version: session_version(account) });
|
|
464
451
|
save_sessions();
|
|
@@ -468,7 +455,7 @@ export function create_gateway({ data, now = Date.now }) {
|
|
|
468
455
|
async function handle(request, response) {
|
|
469
456
|
const path = new URL(request.url, 'http://entry').pathname;
|
|
470
457
|
if (cross_origin(request)) return send_json(response, 403, { error: '不接受来自其他网站的请求' });
|
|
471
|
-
if (path === LOGIN_PATH && request.method === 'GET') return send(response, 200, { 'Content-Type': 'text/html; charset=utf-8' }, login_page());
|
|
458
|
+
if (path === LOGIN_PATH && request.method === 'GET') return send(response, 200, { 'Content-Type': 'text/html; charset=utf-8' }, login_page({ action: LOGIN_PATH }));
|
|
472
459
|
if (path === LOGIN_PATH && request.method === 'POST') return login(request, response);
|
|
473
460
|
if (path === LOGOUT_PATH && request.method === 'POST') {
|
|
474
461
|
if (sessions.delete(token_key(session_token(request)))) save_sessions();
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The entry's sign-in page: one self-contained document (no files, no network), so it opens before anything else is up.
|
|
3
|
+
* It works without scripts; the script adds the language and appearance settings, which use the workspace's own storage
|
|
4
|
+
* keys, so what is chosen here is what the workspace opens with.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const LOGO_DARK = `<defs><linearGradient id="brand-d0" gradientUnits="userSpaceOnUse" x1="4.5" y1="64" x2="95.5" y2="64"><stop offset="0.0%" stop-color="#e9ebed"/><stop offset="6.3%" stop-color="#e2e5e7"/><stop offset="12.5%" stop-color="#dcdee1"/><stop offset="18.8%" stop-color="#d5d8db"/><stop offset="25.0%" stop-color="#ced2d5"/><stop offset="31.3%" stop-color="#c8cbcf"/><stop offset="37.5%" stop-color="#c1c5ca"/><stop offset="43.8%" stop-color="#babfc4"/><stop offset="50.0%" stop-color="#b4b9be"/><stop offset="56.3%" stop-color="#a9aeb3"/><stop offset="62.5%" stop-color="#9ea3a9"/><stop offset="68.8%" stop-color="#93999f"/><stop offset="75.0%" stop-color="#888e95"/><stop offset="81.3%" stop-color="#7e848a"/><stop offset="87.5%" stop-color="#737a80"/><stop offset="93.8%" stop-color="#697077"/><stop offset="100.0%" stop-color="#5f666d"/></linearGradient><linearGradient id="brand-d1" gradientUnits="userSpaceOnUse" x1="8.5" y1="36" x2="91.5" y2="36"><stop offset="0.0%" stop-color="#3f86ff"/><stop offset="6.3%" stop-color="#5588ff"/><stop offset="12.5%" stop-color="#6889ff"/><stop offset="18.8%" stop-color="#788aff"/><stop offset="25.0%" stop-color="#878bff"/><stop offset="31.3%" stop-color="#958cff"/><stop offset="37.5%" stop-color="#a78aef"/><stop offset="43.8%" stop-color="#b986d7"/><stop offset="50.0%" stop-color="#ca80bf"/><stop offset="56.3%" stop-color="#da78a6"/><stop offset="62.5%" stop-color="#ea6e8c"/><stop offset="68.8%" stop-color="#f56d78"/><stop offset="75.0%" stop-color="#f77f72"/><stop offset="81.3%" stop-color="#f8906b"/><stop offset="87.5%" stop-color="#f9a163"/><stop offset="93.8%" stop-color="#fab058"/><stop offset="100.0%" stop-color="#fac04a"/></linearGradient><linearGradient id="brand-d2" gradientUnits="userSpaceOnUse" x1="28.021" y1="95.435" x2="39.978" y2="4.564"><stop offset="0.0%" stop-color="#d06a49"/><stop offset="6.3%" stop-color="#d36f4f"/><stop offset="12.5%" stop-color="#d67456"/><stop offset="18.8%" stop-color="#d97a5c"/><stop offset="25.0%" stop-color="#dc7f62"/><stop offset="31.3%" stop-color="#df8468"/><stop offset="37.5%" stop-color="#e2896e"/><stop offset="43.8%" stop-color="#e58e74"/><stop offset="50.0%" stop-color="#e8937a"/><stop offset="56.3%" stop-color="#eb9d85"/><stop offset="62.5%" stop-color="#eea68f"/><stop offset="68.8%" stop-color="#f1b09a"/><stop offset="75.0%" stop-color="#f4baa4"/><stop offset="81.3%" stop-color="#f6c3af"/><stop offset="87.5%" stop-color="#f9cdb9"/><stop offset="93.8%" stop-color="#fbd6c4"/><stop offset="100.0%" stop-color="#fde0cf"/></linearGradient><linearGradient id="brand-d3" gradientUnits="userSpaceOnUse" x1="71.978" y1="95.435" x2="60.021" y2="4.564"><stop offset="0.0%" stop-color="#4a5cff"/><stop offset="6.3%" stop-color="#5062ff"/><stop offset="12.5%" stop-color="#5768ff"/><stop offset="18.8%" stop-color="#5d6dff"/><stop offset="25.0%" stop-color="#6472ff"/><stop offset="31.3%" stop-color="#6b77ff"/><stop offset="37.5%" stop-color="#717cff"/><stop offset="43.8%" stop-color="#7881ff"/><stop offset="50.0%" stop-color="#7f86ff"/><stop offset="56.3%" stop-color="#8990ff"/><stop offset="62.5%" stop-color="#9399ff"/><stop offset="68.8%" stop-color="#9da2ff"/><stop offset="75.0%" stop-color="#a8abff"/><stop offset="81.3%" stop-color="#b3b4ff"/><stop offset="87.5%" stop-color="#bebdff"/><stop offset="93.8%" stop-color="#c9c5ff"/><stop offset="100.0%" stop-color="#d4ceff"/></linearGradient><clipPath id="brand-d4"><polygon points="16,46.5 84,46.5 84,25.5 16,25.5"/></clipPath><clipPath id="brand-d5"><polygon points="16,48.5 84,48.5 84,23.5 16,23.5"/></clipPath><clipPath id="brand-d6"><polygon points="81.410,86.630 71.410,10.630 50.589,13.369 60.589,89.369"/></clipPath><clipPath id="brand-d7"><polygon points="83.393,86.369 73.393,10.369 48.606,13.630 58.606,89.630"/></clipPath><clipPath id="brand-d8"><polygon points="12,74.5 88,74.5 88,53.5 12,53.5"/></clipPath><clipPath id="brand-d9"><polygon points="12,76.5 88,76.5 88,51.5 12,51.5"/></clipPath><clipPath id="brand-d10"><polygon points="39.410,89.369 49.410,13.369 28.589,10.630 18.589,86.630"/></clipPath><clipPath id="brand-d11"><polygon points="41.393,89.630 51.393,13.630 26.606,10.369 16.606,86.369"/></clipPath></defs><line x1="12" y1="64" x2="88" y2="64" stroke="url(#brand-d0)" stroke-width="15" stroke-linecap="round"/><line x1="16" y1="36" x2="84" y2="36" stroke="url(#brand-d1)" stroke-width="15" stroke-linecap="round"/><line x1="29" y1="88" x2="39" y2="12" stroke="url(#brand-d2)" stroke-width="15" stroke-linecap="round"/><line x1="71" y1="88" x2="61" y2="12" stroke="url(#brand-d3)" stroke-width="15" stroke-linecap="round"/><g clip-path="url(#brand-d4)"><line x1="29" y1="88" x2="39" y2="12" stroke="#202127" stroke-width="21" stroke-linecap="round"/></g><g clip-path="url(#brand-d5)"><line x1="29" y1="88" x2="39" y2="12" stroke="url(#brand-d2)" stroke-width="15" stroke-linecap="round"/></g><g clip-path="url(#brand-d6)"><line x1="16" y1="36" x2="84" y2="36" stroke="#202127" stroke-width="21" stroke-linecap="round"/></g><g clip-path="url(#brand-d7)"><line x1="16" y1="36" x2="84" y2="36" stroke="url(#brand-d1)" stroke-width="15" stroke-linecap="round"/></g><g clip-path="url(#brand-d8)"><line x1="71" y1="88" x2="61" y2="12" stroke="#202127" stroke-width="21" stroke-linecap="round"/></g><g clip-path="url(#brand-d9)"><line x1="71" y1="88" x2="61" y2="12" stroke="url(#brand-d3)" stroke-width="15" stroke-linecap="round"/></g><g clip-path="url(#brand-d10)"><line x1="12" y1="64" x2="88" y2="64" stroke="#202127" stroke-width="21" stroke-linecap="round"/></g><g clip-path="url(#brand-d11)"><line x1="12" y1="64" x2="88" y2="64" stroke="url(#brand-d0)" stroke-width="15" stroke-linecap="round"/></g>`;
|
|
8
|
+
const LOGO_LIGHT = `<defs><linearGradient id="brand-l0" gradientUnits="userSpaceOnUse" x1="4.5" y1="64" x2="95.5" y2="64"><stop offset="0.0%" stop-color="#0b0d0f"/><stop offset="6.3%" stop-color="#101315"/><stop offset="12.5%" stop-color="#16191b"/><stop offset="18.8%" stop-color="#1c1f22"/><stop offset="25.0%" stop-color="#222529"/><stop offset="31.3%" stop-color="#282c2f"/><stop offset="37.5%" stop-color="#2e3237"/><stop offset="43.8%" stop-color="#34393e"/><stop offset="50.0%" stop-color="#3b4045"/><stop offset="56.3%" stop-color="#484d52"/><stop offset="62.5%" stop-color="#555a5f"/><stop offset="68.8%" stop-color="#62676d"/><stop offset="75.0%" stop-color="#70757b"/><stop offset="81.3%" stop-color="#7e8389"/><stop offset="87.5%" stop-color="#8c9297"/><stop offset="93.8%" stop-color="#9aa0a6"/><stop offset="100.0%" stop-color="#a9afb5"/></linearGradient><linearGradient id="brand-l1" gradientUnits="userSpaceOnUse" x1="8.5" y1="36" x2="91.5" y2="36"><stop offset="0.0%" stop-color="#2f7bff"/><stop offset="6.3%" stop-color="#487cff"/><stop offset="12.5%" stop-color="#5a7cff"/><stop offset="18.8%" stop-color="#6a7dff"/><stop offset="25.0%" stop-color="#797dff"/><stop offset="31.3%" stop-color="#877dff"/><stop offset="37.5%" stop-color="#997cee"/><stop offset="43.8%" stop-color="#ae79d3"/><stop offset="50.0%" stop-color="#c174b8"/><stop offset="56.3%" stop-color="#d36b9d"/><stop offset="62.5%" stop-color="#e56080"/><stop offset="68.8%" stop-color="#f15d69"/><stop offset="75.0%" stop-color="#f37162"/><stop offset="81.3%" stop-color="#f5835a"/><stop offset="87.5%" stop-color="#f79550"/><stop offset="93.8%" stop-color="#f8a542"/><stop offset="100.0%" stop-color="#f8b52c"/></linearGradient><linearGradient id="brand-l2" gradientUnits="userSpaceOnUse" x1="28.021" y1="95.435" x2="39.978" y2="4.564"><stop offset="0.0%" stop-color="#b9502f"/><stop offset="6.3%" stop-color="#bd5534"/><stop offset="12.5%" stop-color="#c15a39"/><stop offset="18.8%" stop-color="#c55f3e"/><stop offset="25.0%" stop-color="#c96443"/><stop offset="31.3%" stop-color="#cd6848"/><stop offset="37.5%" stop-color="#d16d4d"/><stop offset="43.8%" stop-color="#d57252"/><stop offset="50.0%" stop-color="#d97757"/><stop offset="56.3%" stop-color="#dd8060"/><stop offset="62.5%" stop-color="#e08a69"/><stop offset="68.8%" stop-color="#e49372"/><stop offset="75.0%" stop-color="#e79c7b"/><stop offset="81.3%" stop-color="#eaa584"/><stop offset="87.5%" stop-color="#edae8d"/><stop offset="93.8%" stop-color="#f0b796"/><stop offset="100.0%" stop-color="#f3c09f"/></linearGradient><linearGradient id="brand-l3" gradientUnits="userSpaceOnUse" x1="71.978" y1="95.435" x2="60.021" y2="4.564"><stop offset="0.0%" stop-color="#2b33e6"/><stop offset="6.3%" stop-color="#3139e9"/><stop offset="12.5%" stop-color="#363fec"/><stop offset="18.8%" stop-color="#3c44ef"/><stop offset="25.0%" stop-color="#4249f3"/><stop offset="31.3%" stop-color="#484ef6"/><stop offset="37.5%" stop-color="#4e53f9"/><stop offset="43.8%" stop-color="#5457fc"/><stop offset="50.0%" stop-color="#5a5cff"/><stop offset="56.3%" stop-color="#6569ff"/><stop offset="62.5%" stop-color="#7075ff"/><stop offset="68.8%" stop-color="#7c80ff"/><stop offset="75.0%" stop-color="#888bff"/><stop offset="81.3%" stop-color="#9595ff"/><stop offset="87.5%" stop-color="#a29fff"/><stop offset="93.8%" stop-color="#afa9ff"/><stop offset="100.0%" stop-color="#bdb3ff"/></linearGradient><clipPath id="brand-l4"><polygon points="16,46.5 84,46.5 84,25.5 16,25.5"/></clipPath><clipPath id="brand-l5"><polygon points="16,48.5 84,48.5 84,23.5 16,23.5"/></clipPath><clipPath id="brand-l6"><polygon points="81.410,86.630 71.410,10.630 50.589,13.369 60.589,89.369"/></clipPath><clipPath id="brand-l7"><polygon points="83.393,86.369 73.393,10.369 48.606,13.630 58.606,89.630"/></clipPath><clipPath id="brand-l8"><polygon points="12,74.5 88,74.5 88,53.5 12,53.5"/></clipPath><clipPath id="brand-l9"><polygon points="12,76.5 88,76.5 88,51.5 12,51.5"/></clipPath><clipPath id="brand-l10"><polygon points="39.410,89.369 49.410,13.369 28.589,10.630 18.589,86.630"/></clipPath><clipPath id="brand-l11"><polygon points="41.393,89.630 51.393,13.630 26.606,10.369 16.606,86.369"/></clipPath></defs><line x1="12" y1="64" x2="88" y2="64" stroke="url(#brand-l0)" stroke-width="15" stroke-linecap="round"/><line x1="16" y1="36" x2="84" y2="36" stroke="url(#brand-l1)" stroke-width="15" stroke-linecap="round"/><line x1="29" y1="88" x2="39" y2="12" stroke="url(#brand-l2)" stroke-width="15" stroke-linecap="round"/><line x1="71" y1="88" x2="61" y2="12" stroke="url(#brand-l3)" stroke-width="15" stroke-linecap="round"/><g clip-path="url(#brand-l4)"><line x1="29" y1="88" x2="39" y2="12" stroke="#f6f6f6" stroke-width="21" stroke-linecap="round"/></g><g clip-path="url(#brand-l5)"><line x1="29" y1="88" x2="39" y2="12" stroke="url(#brand-l2)" stroke-width="15" stroke-linecap="round"/></g><g clip-path="url(#brand-l6)"><line x1="16" y1="36" x2="84" y2="36" stroke="#f6f6f6" stroke-width="21" stroke-linecap="round"/></g><g clip-path="url(#brand-l7)"><line x1="16" y1="36" x2="84" y2="36" stroke="url(#brand-l1)" stroke-width="15" stroke-linecap="round"/></g><g clip-path="url(#brand-l8)"><line x1="71" y1="88" x2="61" y2="12" stroke="#f6f6f6" stroke-width="21" stroke-linecap="round"/></g><g clip-path="url(#brand-l9)"><line x1="71" y1="88" x2="61" y2="12" stroke="url(#brand-l3)" stroke-width="15" stroke-linecap="round"/></g><g clip-path="url(#brand-l10)"><line x1="12" y1="64" x2="88" y2="64" stroke="#f6f6f6" stroke-width="21" stroke-linecap="round"/></g><g clip-path="url(#brand-l11)"><line x1="12" y1="64" x2="88" y2="64" stroke="url(#brand-l0)" stroke-width="15" stroke-linecap="round"/></g>`;
|
|
9
|
+
|
|
10
|
+
// Every text in both languages. A refusal is sent as a key, so the page can say it in the language chosen in this browser.
|
|
11
|
+
const TEXTS = {
|
|
12
|
+
'zh-CN': {
|
|
13
|
+
page_title: '登录 · AI CoDiscuss', tagline: '让你的 AI,在同一个房间里协作',
|
|
14
|
+
tagline_detail: '各自保留原来的会话与工具,一起把事情做完。', heading: '欢迎回来', subheading: '登录后进入你的工作台',
|
|
15
|
+
name: '账号', password: '密码', show_password: '显示密码', hide_password: '隐藏密码', submit: '登录', submitting: '正在登录…',
|
|
16
|
+
help: '账号由为你开通服务的人提供,忘记密码也请联系对方。', settings: '设置', language: '语言', appearance: '外观',
|
|
17
|
+
theme_light: '浅色', theme_dark: '深色',
|
|
18
|
+
wrong: '账号或密码不正确', locked: '尝试次数过多,请 10 分钟后再试', disabled: '这个账号已停用,请联系为你开通的服务商',
|
|
19
|
+
},
|
|
20
|
+
en: {
|
|
21
|
+
page_title: 'Sign in · AI CoDiscuss', tagline: 'Your AIs, working together in one room',
|
|
22
|
+
tagline_detail: 'Each keeps its own sessions and tools, and they get the work done together.', heading: 'Welcome back',
|
|
23
|
+
subheading: 'Sign in to open your workspace', name: 'Account', password: 'Password', show_password: 'Show password',
|
|
24
|
+
hide_password: 'Hide password', submit: 'Sign in', submitting: 'Signing in…',
|
|
25
|
+
help: 'Your account comes from whoever set up this service for you. Ask them if you forget your password.', settings: 'Settings',
|
|
26
|
+
language: 'Language', appearance: 'Appearance', theme_light: 'Light', theme_dark: 'Dark',
|
|
27
|
+
wrong: 'Incorrect account or password', locked: 'Too many attempts. Try again in 10 minutes.',
|
|
28
|
+
disabled: 'This account is disabled. Please contact your service provider.',
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// Threads running in from the edges to the mark: several AIs meeting in one room. [path, colour, seconds, delay]
|
|
33
|
+
const THREADS = [
|
|
34
|
+
['M-40 120C160 150 250 300 400 450', '#3f86ff', 7, 0], ['M840 90C660 160 540 300 400 450', '#f8906b', 8, 1.4],
|
|
35
|
+
['M-40 800C140 720 270 590 400 450', '#fac04a', 9, 2.6], ['M840 820C650 740 530 590 400 450', '#7881ff', 7.5, 0.8],
|
|
36
|
+
['M-40 450C120 420 260 440 400 450', '#ca80bf', 10, 3.2], ['M840 460C680 480 540 450 400 450', '#5588ff', 8.5, 2],
|
|
37
|
+
['M250 -40C270 130 330 290 400 450', '#d97757', 9.5, 4], ['M560 940C530 760 460 600 400 450', '#958cff', 8, 3.6],
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
const escape_html = text => String(text).replace(/[&<>"']/g, mark => `&#${mark.charCodeAt(0)};`);
|
|
41
|
+
|
|
42
|
+
const threads_svg = () => THREADS.map(([path, colour, seconds, delay]) => `<path class="thread" d="${path}"/>`
|
|
43
|
+
+ `<path class="pulse" d="${path}" pathLength="100" stroke="${colour}" style="animation-duration:${seconds}s;animation-delay:-${delay}s"/>`).join('');
|
|
44
|
+
|
|
45
|
+
const STYLE = `
|
|
46
|
+
:root{color-scheme:light;--bg:#f6f6f6;--panel:#ececef;--field:#fff;--line:#d9d9de;--line-strong:#b9b9c2;--text:#1b1c20;--muted:#61636d;--dim:#767885;--accent:#4f51e8;--accent-text:#fff;--danger:#b4243d;--danger-bg:#c4314b14;--thread:#1b1c2014;--shadow:0 16px 40px #1b1c2024}
|
|
47
|
+
:root[data-mode=dark]{color-scheme:dark;--bg:#202127;--panel:#191a1f;--field:#2a2b32;--line:#393a43;--line-strong:#50515c;--text:#f1f2f5;--muted:#a8abb6;--dim:#8d909e;--accent:#8791ff;--accent-text:#14151a;--danger:#ff8a9b;--danger-bg:#ff8a9b18;--thread:#ffffff12;--shadow:0 16px 40px #0007}
|
|
48
|
+
*{box-sizing:border-box}html,body{height:100%}
|
|
49
|
+
body{margin:0;background:var(--bg);color:var(--text);font:15px/1.5 system-ui,-apple-system,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;-webkit-font-smoothing:antialiased}
|
|
50
|
+
button,input{font:inherit;color:inherit}
|
|
51
|
+
.entry{min-height:100%;display:grid;grid-template-columns:minmax(0,1.15fr) minmax(420px,1fr)}
|
|
52
|
+
.stage{position:relative;overflow:hidden;background:var(--panel);display:flex;flex-direction:column;justify-content:flex-end;padding:48px 56px}
|
|
53
|
+
.threads{position:absolute;inset:0;width:100%;height:100%}
|
|
54
|
+
.thread,.pulse{fill:none;stroke-linecap:round}.thread{stroke:var(--thread);stroke-width:1.5}
|
|
55
|
+
.pulse{stroke-width:2.5;stroke-dasharray:14 86;stroke-dashoffset:100;animation:flow linear infinite}
|
|
56
|
+
@keyframes flow{to{stroke-dashoffset:0}}
|
|
57
|
+
.emblem{position:absolute;left:50%;top:50%;width:132px;height:132px;margin:-66px 0 0 -66px;display:grid;place-items:center;border-radius:32px;background:var(--bg);box-shadow:var(--shadow);animation:arrive .8s cubic-bezier(.2,.9,.3,1.2) both}
|
|
58
|
+
.emblem::before,.emblem::after{content:"";position:absolute;inset:0;border-radius:32px;border:1.5px solid var(--accent);opacity:0;animation:ring 4.5s ease-out infinite}
|
|
59
|
+
.emblem::after{animation-delay:2.25s}
|
|
60
|
+
.emblem svg{width:88px;height:88px}
|
|
61
|
+
@keyframes arrive{from{opacity:0;transform:scale(.72)}}
|
|
62
|
+
@keyframes ring{0%{opacity:.45;transform:scale(1)}70%,100%{opacity:0;transform:scale(1.7)}}
|
|
63
|
+
.logo-light,:root[data-mode=dark] .logo-dark{display:block}.logo-dark,:root[data-mode=dark] .logo-light{display:none}
|
|
64
|
+
.pitch{position:relative;max-width:460px;animation:rise .7s .15s ease-out both}
|
|
65
|
+
.pitch h2{margin:0 0 8px;font-size:26px;line-height:1.3;font-weight:650;letter-spacing:-.01em}.pitch p{margin:0;color:var(--muted)}
|
|
66
|
+
.side{position:relative;display:grid;place-items:center;padding:72px 32px 40px}
|
|
67
|
+
.card{width:min(360px,100%);animation:rise .6s .05s ease-out both}
|
|
68
|
+
@keyframes rise{from{opacity:0;transform:translateY(14px)}}
|
|
69
|
+
.wordmark{display:flex;align-items:center;gap:10px;margin-bottom:32px;font-weight:650}.wordmark svg{width:28px;height:28px}
|
|
70
|
+
h1{margin:0;font-size:28px;line-height:1.25;font-weight:680;letter-spacing:-.015em}.sub{margin:6px 0 26px;color:var(--muted)}
|
|
71
|
+
.notice{display:flex;gap:8px;align-items:flex-start;margin:0 0 16px;padding:10px 12px;border-radius:10px;background:var(--danger-bg);color:var(--danger);font-size:14px;animation:nudge .36s ease-out}
|
|
72
|
+
.notice svg{flex:none;width:17px;height:17px;margin-top:2px}
|
|
73
|
+
@keyframes nudge{25%{transform:translateX(-6px)}50%{transform:translateX(5px)}75%{transform:translateX(-3px)}}
|
|
74
|
+
label{display:block;margin-bottom:16px}label>span:first-child{display:block;margin-bottom:6px;font-size:13px;font-weight:550;color:var(--muted)}
|
|
75
|
+
.field{position:relative;display:block}
|
|
76
|
+
input{width:100%;height:46px;padding:0 14px;border:1px solid var(--line);border-radius:10px;background:var(--field);outline:0;font-size:16px;transition:border-color .15s,box-shadow .15s}
|
|
77
|
+
input:hover{border-color:var(--line-strong)}input:focus{border-color:var(--accent);box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 24%,transparent)}
|
|
78
|
+
.has-toggle input{padding-right:46px}
|
|
79
|
+
.icon-button{display:grid;place-items:center;width:36px;height:36px;padding:0;border:0;border-radius:8px;background:none;color:var(--muted);cursor:pointer;transition:background .15s,color .15s}
|
|
80
|
+
.icon-button:hover{background:color-mix(in srgb,var(--text) 9%,transparent);color:var(--text)}.icon-button svg{width:18px;height:18px}
|
|
81
|
+
.reveal{position:absolute;right:5px;top:5px}.reveal .eye-off,.reveal[aria-pressed=true] .eye{display:none}.reveal[aria-pressed=true] .eye-off{display:block}
|
|
82
|
+
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}input:focus-visible{outline:0}
|
|
83
|
+
.submit{position:relative;width:100%;height:46px;margin-top:6px;border:0;border-radius:10px;background:var(--accent);color:var(--accent-text);font-weight:620;cursor:pointer;transition:filter .15s,transform .1s}
|
|
84
|
+
.submit:hover{filter:brightness(1.08)}.submit:active{transform:scale(.985)}.submit[disabled]{cursor:progress;filter:saturate(.7);opacity:.85}
|
|
85
|
+
.spinner{display:none;width:16px;height:16px;margin-right:8px;vertical-align:-3px;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:spin .7s linear infinite}
|
|
86
|
+
.submit[disabled] .spinner{display:inline-block}@keyframes spin{to{transform:rotate(1turn)}}
|
|
87
|
+
.help{margin:18px 0 0;color:var(--dim);font-size:13px}
|
|
88
|
+
.settings{position:absolute;right:20px;top:20px;z-index:2}.settings>.icon-button{width:40px;height:40px}
|
|
89
|
+
.menu{position:absolute;right:0;top:46px;width:260px;padding:14px;border:1px solid var(--line);border-radius:14px;background:var(--field);box-shadow:var(--shadow);transform-origin:top right;animation:pop .16s ease-out}
|
|
90
|
+
.menu[hidden]{display:none}@keyframes pop{from{opacity:0;transform:scale(.96) translateY(-4px)}}
|
|
91
|
+
.menu fieldset{margin:0;padding:0;border:0}.menu fieldset+fieldset{margin-top:14px}.menu legend{padding:0;margin-bottom:6px;font-size:12px;font-weight:600;color:var(--muted)}
|
|
92
|
+
.choices{display:grid;grid-auto-flow:column;grid-auto-columns:1fr;gap:2px;padding:3px;border-radius:9px;background:color-mix(in srgb,var(--text) 7%,transparent)}
|
|
93
|
+
.choices button{height:32px;padding:0 6px;border:0;border-radius:7px;background:none;color:var(--muted);font-size:13px;cursor:pointer;white-space:nowrap}
|
|
94
|
+
.choices button[aria-pressed=true]{background:var(--bg);color:var(--text);font-weight:600;box-shadow:0 1px 3px #0003}
|
|
95
|
+
@media (max-width:860px){.entry{grid-template-columns:1fr;grid-template-rows:auto 1fr}.stage{height:176px;padding:0}.pitch{display:none}.emblem{width:84px;height:84px;margin:-42px 0 0 -42px;border-radius:22px}.emblem::before,.emblem::after{border-radius:22px}.emblem svg{width:56px;height:56px}.side{place-items:start center;padding:28px 24px 36px}.wordmark{display:none}.settings{position:fixed;right:12px;top:12px}}
|
|
96
|
+
@media (prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important}.pulse{stroke-dashoffset:60}}
|
|
97
|
+
`;
|
|
98
|
+
|
|
99
|
+
// Runs before the first paint, so the page never flashes the other theme or language.
|
|
100
|
+
const EARLY_SCRIPT = `(function(){var d=document.documentElement,g=function(k){try{return localStorage.getItem(k)||""}catch(e){return""}},t=g("ai-codiscuss-theme"),l=g("codiscuss.locale");
|
|
101
|
+
d.dataset.mode=t?(/light$/.test(t)?"light":"dark"):(matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");
|
|
102
|
+
d.lang=l==="en"||l==="zh-CN"?l:(/^zh\\b/i.test((navigator.languages&&navigator.languages[0])||navigator.language||"")?"zh-CN":"en")})()`;
|
|
103
|
+
|
|
104
|
+
const PAGE_SCRIPT = `(function(){var T=__TEXTS__,LOCALE="codiscuss.locale",THEME="ai-codiscuss-theme",d=document.documentElement,$=function(s){return document.querySelector(s)},$$=function(s){return Array.prototype.slice.call(document.querySelectorAll(s))};
|
|
105
|
+
function get(k){try{return localStorage.getItem(k)||""}catch(e){return""}}function put(k,v){try{v?localStorage.setItem(k,v):localStorage.removeItem(k)}catch(e){}}
|
|
106
|
+
var dark=matchMedia("(prefers-color-scheme: dark)"),menu=$("#settings-menu"),gear=$("#settings-button"),form=$("#login"),pass=$("#password"),eye=$("#reveal"),send=$("#submit");
|
|
107
|
+
function say(){var t=T[d.lang]||T["zh-CN"];document.title=t.page_title;$$("[data-text]").forEach(function(n){n.textContent=t[n.dataset.text]});$$("[data-label]").forEach(function(n){n.setAttribute("aria-label",t[n.dataset.label]);n.title=t[n.dataset.label]});var e=t[pass.type==="text"?"hide_password":"show_password"];eye.setAttribute("aria-label",e);eye.title=e;$$("[data-locale]").forEach(function(n){n.setAttribute("aria-pressed",String(n.dataset.locale===d.lang))})}
|
|
108
|
+
function paint(){var saved=get(THEME),mode=saved?(/light$/.test(saved)?"light":"dark"):(dark.matches?"dark":"light");d.dataset.mode=mode;$$("[data-theme-choice]").forEach(function(n){n.setAttribute("aria-pressed",String(n.dataset.themeChoice===mode))})}
|
|
109
|
+
function show_menu(show){menu.hidden=!show;gear.setAttribute("aria-expanded",String(show))}
|
|
110
|
+
gear.addEventListener("click",function(e){e.stopPropagation();show_menu(menu.hidden)});menu.addEventListener("click",function(e){e.stopPropagation()});document.addEventListener("click",function(){show_menu(false)});document.addEventListener("keydown",function(e){if(e.key==="Escape"&&!menu.hidden){show_menu(false);gear.focus()}});
|
|
111
|
+
$$("[data-locale]").forEach(function(n){n.addEventListener("click",function(){d.lang=n.dataset.locale;put(LOCALE,d.lang);say()})});
|
|
112
|
+
$$("[data-theme-choice]").forEach(function(n){n.addEventListener("click",function(){put(THEME,n.dataset.themeChoice==="light"?"channel-light":"channel");paint()})});
|
|
113
|
+
dark.addEventListener("change",paint);
|
|
114
|
+
eye.addEventListener("click",function(){var show=pass.type==="password";pass.type=show?"text":"password";eye.setAttribute("aria-pressed",String(show));say();pass.focus()});
|
|
115
|
+
form.addEventListener("submit",function(){send.disabled=true;var l=$("#submit-label");l.dataset.text="submitting";l.textContent=(T[d.lang]||T["zh-CN"]).submitting});
|
|
116
|
+
window.addEventListener("pageshow",function(e){if(e.persisted){send.disabled=false;$("#submit-label").dataset.text="submit";say()}});
|
|
117
|
+
say();paint();if(matchMedia("(hover: hover)").matches){var first=$("#name");(first.value?pass:first).focus()}})()`;
|
|
118
|
+
|
|
119
|
+
const ICON = {
|
|
120
|
+
settings: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 7h10M18 7h2M4 17h2M10 17h10"/><circle cx="16" cy="7" r="2"/><circle cx="8" cy="17" r="2"/></svg>',
|
|
121
|
+
eye: '<svg class="eye" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12Z"/><circle cx="12" cy="12" r="3"/></svg>',
|
|
122
|
+
eye_off: '<svg class="eye-off" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 3l18 18M10.6 5.6A9 9 0 0 1 12 5.5c6 0 9.5 6.5 9.5 6.5a16 16 0 0 1-3 3.7M6.5 6.9A16 16 0 0 0 2.5 12S6 18.5 12 18.5a9 9 0 0 0 4.3-1.1M9.9 9.9a3 3 0 0 0 4.2 4.2"/></svg>',
|
|
123
|
+
alert: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true"><circle cx="12" cy="12" r="9"/><path d="M12 7.5v5.5M12 16.5v.01"/></svg>',
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* The sign-in page.
|
|
128
|
+
* @param {object} options
|
|
129
|
+
* @param {string} options.action Where the form posts.
|
|
130
|
+
* @param {'wrong'|'locked'|'disabled'} [options.refusal] Why the last attempt was refused.
|
|
131
|
+
* @param {string} [options.name] The account just tried, kept in its field.
|
|
132
|
+
* @returns {string} The whole HTML document.
|
|
133
|
+
*/
|
|
134
|
+
export function login_page({ action, refusal = '', name = '' }) {
|
|
135
|
+
const zh = TEXTS['zh-CN'];
|
|
136
|
+
const text = key => `data-text="${key}">${zh[key]}`;
|
|
137
|
+
const logos = `<svg class="logo-dark" viewBox="0 0 100 100" aria-hidden="true">${LOGO_DARK}</svg><svg class="logo-light" viewBox="0 0 100 100" aria-hidden="true">${LOGO_LIGHT}</svg>`;
|
|
138
|
+
const small_logos = logos.replaceAll('brand-d', 'small-d').replaceAll('brand-l', 'small-l');
|
|
139
|
+
const notice = refusal ? `<p class="notice" role="alert">${ICON.alert}<span ${text(refusal)}</span></p>` : '';
|
|
140
|
+
return `<!doctype html><html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
|
|
141
|
+
<title>${zh.page_title}</title><script>${EARLY_SCRIPT}</script><style>${STYLE}</style></head><body><main class="entry">
|
|
142
|
+
<section class="stage"><svg class="threads" viewBox="0 0 800 900" preserveAspectRatio="xMidYMid slice" aria-hidden="true">${threads_svg()}</svg><div class="emblem" aria-hidden="true">${logos}</div>
|
|
143
|
+
<div class="pitch"><h2 ${text('tagline')}</h2><p ${text('tagline_detail')}</p></div></section>
|
|
144
|
+
<section class="side"><div class="settings"><button id="settings-button" class="icon-button" type="button" aria-expanded="false" aria-controls="settings-menu" data-label="settings" aria-label="${zh.settings}" title="${zh.settings}">${ICON.settings}</button>
|
|
145
|
+
<div id="settings-menu" class="menu" hidden><fieldset><legend ${text('language')}</legend><div class="choices"><button type="button" data-locale="zh-CN">简体中文</button><button type="button" data-locale="en">English</button></div></fieldset>
|
|
146
|
+
<fieldset><legend ${text('appearance')}</legend><div class="choices"><button type="button" data-theme-choice="light" ${text('theme_light')}</button><button type="button" data-theme-choice="dark" ${text('theme_dark')}</button></div></fieldset></div></div>
|
|
147
|
+
<div class="card"><div class="wordmark">${small_logos}<span>AI CoDiscuss</span></div><h1 ${text('heading')}</h1><p class="sub" ${text('subheading')}</p>${notice}
|
|
148
|
+
<form id="login" method="post" action="${action}"><label><span ${text('name')}</span><span class="field"><input id="name" name="name" value="${escape_html(name)}" autocomplete="username" autocapitalize="none" spellcheck="false" required></span></label>
|
|
149
|
+
<label><span ${text('password')}</span><span class="field has-toggle"><input id="password" name="password" type="password" autocomplete="current-password" required><button id="reveal" class="icon-button reveal" type="button" aria-pressed="false" aria-label="${zh.show_password}" title="${zh.show_password}">${ICON.eye}${ICON.eye_off}</button></span></label>
|
|
150
|
+
<button id="submit" class="submit" type="submit"><i class="spinner" aria-hidden="true"></i><span id="submit-label" ${text('submit')}</span></button></form><p class="help" ${text('help')}</p></div></section></main>
|
|
151
|
+
<script>${PAGE_SCRIPT.replace('__TEXTS__', () => JSON.stringify(TEXTS))}</script></body></html>`;
|
|
152
|
+
}
|
package/package.json
CHANGED
package/runner/adapters/api.mjs
CHANGED
|
@@ -93,7 +93,7 @@ function role_tools(context) {
|
|
|
93
93
|
also_request_ids: { type: 'array', items: NUMBER, maxItems: 20, description: '执行中又排队给你、这条回答已一并交付的普通请求编号(read_execution 的 queued_requests),同时关闭;不相关的不要填' },
|
|
94
94
|
...(context.image ? { attachments: { type: 'array', maxItems: MAX_MESSAGE_ATTACHMENTS, items: TEXT,
|
|
95
95
|
description: `要随回答发出的图片附件 ID,按顺序:本次生成的,或 task.unsent_images 里之前生成未发出的;不填则发出本次生成的全部图片(最多 ${MAX_MESSAGE_ATTACHMENTS} 张)` } } : {}) };
|
|
96
|
-
const submit = tool('submit_chat', '保存本次执行的完整回答并结束;summary 仅在回答较长时填写;只有主持人可用 to 点名成员,派出的工作做完或失败都会交回你(只点名一位、回答已足以直接给用户时可加 no_handoff: true,失败仍交回);to 点名多位并加 sequential: true 时按点名顺序依次接力、最后交回你,依次接力走完一圈算一轮,再加 loop: true 则交回为检查点;parallel 列出要同一棒同时做的几组成员(每组至少两位、在 to 中相邻),这一组全部结束才交下一棒,组里有人失败则接力停下交回你;gates 在接力中途设检查点(每项 {after: 成员, repeat_from?: 成员, user?: true}):after 所在那一棒结束后交回你,带 repeat_from 时为循环检查点、可从 repeat_from 所在那一棒再来一圈,repeat_from 不能早于前一个检查点;带 user: true 时改为等用户回答问题、不交回你:after 那一棒用 ask_question(handoff)交候选并出题,用户回答后接着往下一棒走(带 repeat_from 则再来一圈),普通聊天不推进,最后一棒之后须带 repeat_from;detach
|
|
96
|
+
const submit = tool('submit_chat', '保存本次执行的完整回答并结束;summary 仅在回答较长时填写;只有主持人可用 to 点名成员,派出的工作做完或失败都会交回你(只点名一位、回答已足以直接给用户时可加 no_handoff: true,失败仍交回);to 点名多位并加 sequential: true 时按点名顺序依次接力、最后交回你,依次接力走完一圈算一轮,再加 loop: true 则交回为检查点;parallel 列出要同一棒同时做的几组成员(每组至少两位、在 to 中相邻),这一组全部结束才交下一棒,组里有人失败则接力停下交回你;gates 在接力中途设检查点(每项 {after: 成员, repeat_from?: 成员, user?: true}):after 所在那一棒结束后交回你,带 repeat_from 时为循环检查点、可从 repeat_from 所在那一棒再来一圈,repeat_from 不能早于前一个检查点;带 user: true 时改为等用户回答问题、不交回你:after 那一棒用 ask_question(handoff)交候选并出题,用户回答后接着往下一棒走(带 repeat_from 则再来一圈),普通聊天不推进,最后一棒之后须带 repeat_from;detach 列出在后台工作、不等待的成员(不交回、不占住房间、不计入交回或下一棒;可单独用,也可随 to 同时开工),它失败时程序通知你;主持人要在房间空闲后接着推进时填 continue(写明继续做什么),算本链一轮;派活时可用 need_rounds(本任务从这次派活起还需要的轮数)加 rounds_reason 向用户申请轮数,超过本链剩余时任务链立即停下等用户批准',
|
|
97
97
|
{ ...answer, ...(context.role === 'host' ? { to: { type: 'array', items: TEXT }, sequential: { type: 'boolean' }, loop: { type: 'boolean' }, parallel: { type: 'array', items: { type: 'array', items: TEXT } },
|
|
98
98
|
gates: { type: 'array', items: { type: 'object', properties: { after: TEXT, repeat_from: TEXT, user: { type: 'boolean' } }, required: ['after'] } }, detach: { type: 'array', items: TEXT }, no_handoff: { type: 'boolean' }, continue: { ...TEXT, maxLength: 300 },
|
|
99
99
|
need_rounds: { type: 'integer', minimum: 1, maximum: 100 }, rounds_reason: { ...TEXT, maxLength: 300 },
|
package/runner/discuss.py
CHANGED
|
@@ -394,7 +394,7 @@ def message_commands(subcommands, registry):
|
|
|
394
394
|
post.add_argument("--also-request", dest="also_requests", type=positive_int, action="append", default=[], metavar="REQUEST",
|
|
395
395
|
help="执行中又排队给你的普通请求(execution view 的 queued_requests)与本次任务相关、这条回答已一并交付时,用它同时关闭;可重复")
|
|
396
396
|
post.add_argument("--detach", type=member_handle, action="append", default=[], metavar="MEMBER",
|
|
397
|
-
help="
|
|
397
|
+
help="自由房间主持人:点名一位在后台工作、不等它的成员:不交回你、不占住房间(用户发消息不排队),也不计入交回或下一棒的等待;可单独用,也可与 --to 同用;它失败时程序通知你;可重复")
|
|
398
398
|
post.add_argument("--with", dest="to", type=member_handle, action=JoinPreviousStep, metavar="MEMBER",
|
|
399
399
|
help="与 --sequential 同用:点名一位成员,与紧挨在前的 --to(或 --with)同一棒、同时做;这一组全部结束才交下一棒,组里有人失败则接力停下交回你;可重复")
|
|
400
400
|
post.add_argument("--need-rounds", type=positive_int, metavar="N",
|
|
@@ -869,8 +869,6 @@ def plan_message(args):
|
|
|
869
869
|
if args.loop and not args.sequential:
|
|
870
870
|
raise CliError("--loop 须与 --sequential 一起使用")
|
|
871
871
|
if args.detach:
|
|
872
|
-
if not args.to:
|
|
873
|
-
raise CliError("--detach 须与 --to 一起使用")
|
|
874
872
|
payload["detach"] = args.detach
|
|
875
873
|
if getattr(args, "also_requests", None):
|
|
876
874
|
payload["also_request_ids"] = args.also_requests
|