ai_co_discuss 0.5.14 → 0.5.16
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/members.md +1 -0
- package/.agents/skills/discuss-participant/SKILL.md +4 -2
- package/.agents/skills/discuss-participant/references/interactive-html.md +44 -61
- package/.agents/skills/discuss-participant/references/visual-examples.md +196 -0
- package/.agents/skills/discuss-session/references/host-closing.md +2 -1
- package/README.md +1 -0
- package/README.zh-CN.md +1 -0
- package/backend/free_room.py +56 -9
- package/backend/mode_room.py +1 -1
- package/backend/schema.sql +46 -0
- package/backend/server.py +211 -9
- package/backend/session_room.py +20 -2
- package/backend/visual_fences.py +59 -0
- package/docs/deployment.md +2 -20
- package/docs/en/deployment.md +2 -20
- package/docs/en/guide/faq.md +2 -0
- package/docs/en/guide/members.md +1 -1
- package/docs/en/guide/rooms.md +1 -1
- package/docs/en/guide/working.md +14 -1
- package/docs/guide/faq.md +2 -0
- package/docs/guide/members.md +1 -1
- package/docs/guide/rooms.md +1 -1
- package/docs/guide/working.md +14 -1
- package/frontend/locales/en/app.json +48 -2
- package/frontend/locales/en/backend.json +3 -0
- package/frontend/locales/en/core.json +1 -0
- package/frontend/locales/en/discussion.json +16 -6
- package/frontend/locales/en/room.json +30 -7
- package/frontend/locales/en/settings.json +7 -1
- package/package.json +1 -1
- package/runner/codiscuss.mjs +2 -0
- package/runner/discuss.py +7 -3
- package/runner/discussion_launch.mjs +31 -5
- package/runner/expert_prompts.mjs +10 -1
- package/runner/free_runner.mjs +31 -4
- package/runner/i18n_en.mjs +23 -2
- package/runner/remote_launch.mjs +2 -0
- package/runner/site_deploy.mjs +900 -0
- package/web/app.js +133 -39
- package/web/i18n.js +2 -2
- package/web/markdown.js +2 -1
- package/web/modern.css +1 -1
- package/web/modern.js +94 -66
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
- **项目权限**:要改文件或跑命令的活,先在 `room view` 核对成员权限,只读成员只派审阅和核对。只读的 Antigravity 跑网站命令以外的命令会直接结束本轮。
|
|
12
12
|
- **软件不同,表现不同**:成员是“软件 + 模型 + 强度”的组合。API 成员强度只有 low / medium / high,能读网页和项目文件、可写时能跑命令,做不了主活的也可派搜集、核对、整理,不要晾着。
|
|
13
13
|
- **贵模型不默认派**:Claude Fable 这类最贵的模型,同样的活额度消耗是常用模型的数倍,用户要求或别的确实解决不了时再用。
|
|
14
|
+
- **浏览器验收与截图**:要在真实浏览器里实测界面、截图给用户看时,派**可写**的 Codex CLI 成员:它能用仓库代码另起临时站点,按指定视口和触屏仿真操作 Chrome、截图并作为附件交回。只读时起不了站点、跑不了命令,先把它改为可写再派。被接入程序唤醒的 Claude Code 实测没有可用的浏览器工具,不要指望它截图。
|
|
14
15
|
- **讨论选人**:主持人之外每家厂商各派一位代表,不让同一家的两位同场:同一家的看法往往相近。
|
|
15
16
|
|
|
16
17
|
## 各家一览
|
|
@@ -18,7 +18,7 @@ description: "AI CoDiscuss 的通用参与技能,所有参与者(包括主
|
|
|
18
18
|
| 手动成员注册、原会话或手动回答 | [手动接入](references/manual.md) |
|
|
19
19
|
| 写入结果不明、被拒、超长正文 | [写入与恢复](references/writing.md) |
|
|
20
20
|
| 接力(`sequence`)、向用户提问(`question`)、生图(`image`)、主动发言 | [按需场景](references/situations.md) |
|
|
21
|
-
|
|
|
21
|
+
| 回答需要用户亲手操作的演示(交互式可视化,正文里的 `visual` 代码块) | [交付交互式可视化](references/interactive-html.md) |
|
|
22
22
|
|
|
23
23
|
## 硬约束
|
|
24
24
|
|
|
@@ -52,8 +52,10 @@ description: "AI CoDiscuss 的通用参与技能,所有参与者(包括主
|
|
|
52
52
|
|
|
53
53
|
用请求者使用的语言回答,结论先行;篇幅与结构由你按问题决定。正文约 300 字以上或分多段时写摘要:给只听语音播报的人,约 15 秒念完(不超过约 80 字),用能直接念出口的话、不用列表和编号。
|
|
54
54
|
|
|
55
|
-
**给人看的成品默认作为附件交付**:这次新建或改出、请求者要看或要拿走的结果(文档、表格、幻灯片、PDF
|
|
55
|
+
**给人看的成品默认作为附件交付**:这次新建或改出、请求者要看或要拿走的结果(文档、表格、幻灯片、PDF、图片、音视频、放不进正文的大网页,或它们的打包;要在正文里直接运行的页面写成 `visual` 代码块,不另附),上传为附件,正文用 `[文件 #n]`(图片 `[图片 #n]`)引用(n 是该文件在本条 `--attachment` 中的先后序号,从 1 起,不是附件 ID;提交后程序换成房间内的统一编号);改了已交付的成品就附上新版。(附件随消息保存、卡片内直接预览,分享页、其他设备和外部成员都看得到;项目文件之后会变,也只有能读这台电脑的人看得到。)项目源码与配置的修改、中间产物和日志不附(执行卡片已显示文件差异)。用户说了只放项目里的也不附,正文用反引号写出它的项目路径(如 `合同.docx`),回答下方会出现该文件的卡片。
|
|
56
56
|
|
|
57
57
|
附件先 `attachment upload ROOM --file FILE --submission-id 上传编号`,再 `message post --attachment ID`(最多 10 个,单个 20 MiB,须在执行资格结束前上传)。
|
|
58
58
|
|
|
59
|
+
**网站**:做出多文件网页(如构建出的 `dist/`)时,用 `site stage --dir 目录` 登记为待部署,回答下方会出现“部署为网站”卡片,由用户决定是否上线。只有请求者在本房间明确要求部署或发布时,才用 `site publish --dir 目录`(更新已有站点加 `--site 编号`)直接上线,并在回答里写出网址;预检拒绝时如实说明,不绕过。(上线即公开,任何拿到地址的人都能打开。)
|
|
60
|
+
|
|
59
61
|
提交后核对回执(消息编号、作者、执行或请求关联;正文只给 `text_chars` 字数),足够就不再读一遍。提交成功后在当前会话只回一句(如“已提交 #编号”),不复述正文。执行结束不等于房间的工作结束。
|
|
@@ -1,24 +1,46 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 交付交互式可视化
|
|
2
2
|
|
|
3
3
|
只在你判断回答需要用户亲手操作(拖动参数看变化、点开分步讲解、可点的界面原型)时读本页。怎么设计页面由你决定;本页只写房间网页怎样显示它、给了页面什么、有哪些限制。
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## 写法:正文里的 `visual` 代码块
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|---|---|---|
|
|
9
|
-
| 正文引用的附件 | 回答里的一张图:一个量变了,图跟着变 | 在正文写 `[文件 #n]` 的位置直接显示,没有边框和底色,高度随内容;下方一行小字可收起、放大、看源码、下载 |
|
|
10
|
-
| 未引用的附件 | 篇幅大、不必打断阅读的页面 | 回答下方的文件卡片,点“在消息内展开”或点开预览窗口才运行 |
|
|
11
|
-
| 项目文件 | 要随项目保留、反复修改的页面 | 用户在“项目文件”里打开;按相对路径引用的样式、脚本、图片由电脑内联后一起显示 |
|
|
7
|
+
在回答正文里写一个信息串恰好为 `visual` 的围栏代码块,内容是一份自包含的 HTML(完整文档或片段都行)。网页在代码块所在位置直接显示并运行它,外面由房间加一圈淡边框和少量内边距与正文区分,高度随内容;页面自己不要再画外框和底色;下方一行小字可收起、看源码、放大到预览窗口、在新标签页打开、下载。手机上同样就地显示。
|
|
12
8
|
|
|
13
|
-
|
|
9
|
+
````markdown
|
|
10
|
+
前面写引出它的话。
|
|
14
11
|
|
|
15
|
-
|
|
12
|
+
```visual
|
|
13
|
+
<div class="wrap">…</div>
|
|
14
|
+
<script>…</script>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
后面写结论。
|
|
18
|
+
````
|
|
19
|
+
|
|
20
|
+
- 只有 `visual` 会显示;` ```html ` 等其他代码块照常显示源码,给人看代码时用它们。
|
|
21
|
+
- 一条回答可以有多个 `visual` 代码块,各自独立。
|
|
22
|
+
- 正文上限 32000 字,页面代码也算在内,单个页面建议不超过约 30000 字。更大的页面改为上传 `.html` 附件:附件只在文件卡片、预览窗口和新标签页里打开,不在消息内显示。
|
|
23
|
+
- 其他成员用 `message list` 读历史时,`visual` 代码块折叠成一行并注明字符数;要看源码用 `message view`。
|
|
24
|
+
- 用户自己的消息里的 `visual` 代码块只显示源码,不运行。
|
|
25
|
+
|
|
26
|
+
## 向用户收集选择
|
|
27
|
+
|
|
28
|
+
**问题卡能表达的都用问题卡**(见 [按需场景](situations.md)“向用户提问”):单选、多选、逐条选一档、补一句说明,即使条目很多也一样,问题卡还能阻塞等待、答完交回提问者。只有问题卡做不到时才把可视化做成提问面板,限于三种情况:
|
|
16
29
|
|
|
17
|
-
|
|
30
|
+
1. 选项之间要联动计算:改一个值,结果、排名或总量当场变化,用户要看着结果做决定(如调权重看方案排名)。
|
|
31
|
+
2. 量是连续的:比例、权重、阈值、时间点。
|
|
32
|
+
3. 答案在图上:在平面图、时间轴、界面示意图上指出位置。
|
|
33
|
+
|
|
34
|
+
- 面板里放一个按钮,用户点击时调用 `window.codiscuss.submit(文字, 字段)`。文字是给人看的结论,逐项写全名和数值(如“排序:A、D、B;预算:A 50%、D 30%、B 20%”),不超过 2000 字;字段可选,是同样内容的结构化对象。
|
|
35
|
+
- 结果不会直接发出:房间把它作为引用放到用户输入框上方,用户看过、可以删改,点发送才算回答,发出的是用户本人的消息。同一面板再次提交会替换上一次的结果。引用里的 `@` 和 `/` 命令不生效,要交回给谁由用户决定。
|
|
36
|
+
- 先判断 `window.codiscuss?.submit` 是否存在:在新标签页、下载的文件、分享页里没有它,这时隐藏按钮或提示用户直接打字回答。
|
|
37
|
+
- 正文里同时写一句文字版的答法(如“也可以直接回复:按优先级列出 A 到 F”),面板用不了时用户照样能答。
|
|
38
|
+
- 优先用原生控件(滑块、复选框、下拉框);拖拽只作增强,同时提供上移、下移按钮。
|
|
39
|
+
- 面板里的得分、估算由你给出时,写明依据,凭判断的标“假设”;交回的结论带上前提(如“在这组得分下选 A”),别让精确的数字显得比依据更可靠。
|
|
18
40
|
|
|
19
41
|
## 房间给页面的东西
|
|
20
42
|
|
|
21
|
-
|
|
43
|
+
房间往页面里注入一份基础样式和下面的变量。变量在页面载入后送到,用户切换深浅色时再送一次。
|
|
22
44
|
|
|
23
45
|
| 变量 | 含义 |
|
|
24
46
|
|---|---|
|
|
@@ -39,55 +61,16 @@
|
|
|
39
61
|
## 约束
|
|
40
62
|
|
|
41
63
|
- **不设页面底色,不设 `body` 字体和颜色**:设了也不生效。需要色块时用 `--codiscuss-card`。
|
|
42
|
-
- **颜色只用变量,并写兜底值**:如 `var(--codiscuss-accent, #2563eb)
|
|
64
|
+
- **颜色只用变量,并写兜底值**:如 `var(--codiscuss-accent, #2563eb)`。放大的预览窗口、手机全屏和新标签页也注入房间主题,兜底值用于变量到达前或下载后直接打开时。不写 `prefers-color-scheme`,深浅色由房间决定。
|
|
43
65
|
- **颜色写在 CSS 里**(SVG 用 `fill`、`stroke` 引用变量),不在脚本里读一次存起来:变量晚于页面脚本到达,切换主题时还会变。
|
|
44
|
-
- **不写固定高度**:房间测量 `body`
|
|
66
|
+
- **不写固定高度**:房间测量 `body` 的实际高度来定显示高度,内容多高就显示多高,框内不出现滚动条。不用 `100vh`、`height: 100%` 撑满:框的高度就是量到的内容高度,撑满后不会再缩回去;页面很长时考虑拆成几块或用分步切换。
|
|
45
67
|
- **不写固定宽度**:显示宽度等于正文栏,随窗口变化;预览窗口更宽。内容设宽度上限并居中,窄到 320px 时仍能用。字号用 `em`,跟随房间字号。
|
|
46
|
-
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
```html
|
|
56
|
-
<!doctype html>
|
|
57
|
-
<html lang="zh-CN">
|
|
58
|
-
<head>
|
|
59
|
-
<meta charset="utf-8">
|
|
60
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
61
|
-
<title>复利演示</title>
|
|
62
|
-
<style>
|
|
63
|
-
.wrap { max-width: 560px; margin: 0 auto; }
|
|
64
|
-
.muted { color: var(--codiscuss-text-muted, #6b7280); }
|
|
65
|
-
.result { font-size: 1.8em; font-weight: 600; font-variant-numeric: tabular-nums; margin: 0; }
|
|
66
|
-
.bar { height: 6px; margin: .8em 0; border-radius: 3px; background: var(--codiscuss-border, #d4d4d8); }
|
|
67
|
-
.bar i { display: block; height: 100%; border-radius: 3px; background: var(--codiscuss-accent, #2563eb); }
|
|
68
|
-
.row { display: flex; gap: 1em; align-items: center; }
|
|
69
|
-
.row input { flex: 1; }
|
|
70
|
-
</style>
|
|
71
|
-
</head>
|
|
72
|
-
<body>
|
|
73
|
-
<div class="wrap">
|
|
74
|
-
<p class="result" id="result"></p>
|
|
75
|
-
<p class="muted">本金 1000,年化 7%</p>
|
|
76
|
-
<div class="bar"><i id="fill"></i></div>
|
|
77
|
-
<label class="row"><span>年数</span><input id="years" type="range" min="1" max="40" value="20"><output id="out" class="muted"></output></label>
|
|
78
|
-
</div>
|
|
79
|
-
<script>
|
|
80
|
-
const PRINCIPAL = 1000, RATE = 0.07, MAX_YEARS = 40;
|
|
81
|
-
const years = document.getElementById('years');
|
|
82
|
-
function render() {
|
|
83
|
-
const count = Number(years.value), value = PRINCIPAL * (1 + RATE) ** count;
|
|
84
|
-
document.getElementById('out').textContent = count + ' 年';
|
|
85
|
-
document.getElementById('result').textContent = Math.round(value).toLocaleString();
|
|
86
|
-
document.getElementById('fill').style.width = 100 * value / (PRINCIPAL * (1 + RATE) ** MAX_YEARS) + '%';
|
|
87
|
-
}
|
|
88
|
-
years.oninput = render;
|
|
89
|
-
render();
|
|
90
|
-
</script>
|
|
91
|
-
</body>
|
|
92
|
-
</html>
|
|
93
|
-
```
|
|
68
|
+
- **没有网络**:外部脚本、样式、字体、图片和 `fetch` 都被拦截,CDN 上的库载不进来。CSS、JS、数据都写进代码块;图片用 data URL 或内联 SVG。
|
|
69
|
+
- **只能运行脚本**:`alert`、`confirm`、打开新窗口、提交表单都不可用。页面读不到房间、网站接口和 Cookie,`localStorage` 不可用(读写放进 `try`)。页面不能写回房间,也不能唤醒成员。
|
|
70
|
+
- **状态不会保存**:页面滚到附近才开始运行,之后一直保留;但收起、切换房间或刷新后会重新运行,用户调过的参数回到初始值。默认参数要能说明问题。
|
|
71
|
+
- **结论写在正文**:只读分享页、语音播报和消息折叠时的预览只显示“交互式可视化”一行,不运行页面。页面只承载可操作的部分,结论、关键数字、默认参数下看到的结果写在正文文字里。
|
|
72
|
+
- **自查**:交付前读一遍代码,确认没有引用本机路径、没有写入密钥。
|
|
73
|
+
|
|
74
|
+
## 示例
|
|
75
|
+
|
|
76
|
+
写页面前读 [交互式可视化示例](visual-examples.md):一个纯展示,一个提问面板(调权重看排名并交回)。
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# 交互式可视化示例
|
|
2
|
+
|
|
3
|
+
写页面前按需读一个,照结构改,不必照抄题材。规则与约束见 [交付交互式可视化](interactive-html.md)。
|
|
4
|
+
|
|
5
|
+
## 1. 展示:一个量变了,图跟着变
|
|
6
|
+
|
|
7
|
+
````markdown
|
|
8
|
+
年数越长,复利效果越明显:默认 20 年,1000 元变成约 3870 元。
|
|
9
|
+
|
|
10
|
+
```visual
|
|
11
|
+
<style>
|
|
12
|
+
.wrap { max-width: 560px; margin: 0 auto; }
|
|
13
|
+
.muted { color: var(--codiscuss-text-muted, #6b7280); }
|
|
14
|
+
.result { font-size: 1.8em; font-weight: 600; font-variant-numeric: tabular-nums; margin: 0; }
|
|
15
|
+
.bar { height: 6px; margin: .8em 0; border-radius: 3px; background: var(--codiscuss-border, #d4d4d8); }
|
|
16
|
+
.bar i { display: block; height: 100%; border-radius: 3px; background: var(--codiscuss-accent, #2563eb); }
|
|
17
|
+
.row { display: flex; gap: 1em; align-items: center; }
|
|
18
|
+
.row input { flex: 1; }
|
|
19
|
+
</style>
|
|
20
|
+
<div class="wrap">
|
|
21
|
+
<p class="result" id="result"></p>
|
|
22
|
+
<p class="muted">本金 1000,年化 7%</p>
|
|
23
|
+
<div class="bar"><i id="fill"></i></div>
|
|
24
|
+
<label class="row"><span>年数</span><input id="years" type="range" min="1" max="40" value="20"><output id="out" class="muted"></output></label>
|
|
25
|
+
</div>
|
|
26
|
+
<script>
|
|
27
|
+
const PRINCIPAL = 1000, RATE = 0.07, MAX_YEARS = 40;
|
|
28
|
+
const years = document.getElementById('years');
|
|
29
|
+
function render() {
|
|
30
|
+
const count = Number(years.value), value = PRINCIPAL * (1 + RATE) ** count;
|
|
31
|
+
document.getElementById('out').textContent = count + ' 年';
|
|
32
|
+
document.getElementById('result').textContent = Math.round(value).toLocaleString();
|
|
33
|
+
document.getElementById('fill').style.width = 100 * value / (PRINCIPAL * (1 + RATE) ** MAX_YEARS) + '%';
|
|
34
|
+
}
|
|
35
|
+
years.oninput = render;
|
|
36
|
+
render();
|
|
37
|
+
</script>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
拖到 40 年约 14975 元:后 20 年多赚的钱,是前 20 年的近 4 倍。
|
|
41
|
+
````
|
|
42
|
+
|
|
43
|
+
## 2. 提问面板:调权重看方案排名
|
|
44
|
+
|
|
45
|
+
属于问题卡做不到的“联动计算”:用户拖权重,排名当场重算,每个权重的轨道上标出第一名不变的区间;点按钮交回权重与选择。要点:
|
|
46
|
+
|
|
47
|
+
- 得分附依据(展开“得分与依据”),主观折算的写明是假设;交回的文字带上前提。
|
|
48
|
+
- 没有 `window.codiscuss?.submit` 时隐藏按钮,改为提示打字回复。
|
|
49
|
+
|
|
50
|
+
````markdown
|
|
51
|
+
按你“质量和中文更重要”的偏好,Neon 与 Opus 几乎打平;中文表达权重超过 3.1 时 Opus 第一。也可以直接回复四个权重。
|
|
52
|
+
|
|
53
|
+
```visual
|
|
54
|
+
<style>
|
|
55
|
+
.wrap { max-width: 600px; margin: 0 auto; }
|
|
56
|
+
.eyebrow { margin: 0; font-size: .78em; letter-spacing: .04em; color: var(--codiscuss-text-hint, #9ca3af); }
|
|
57
|
+
.lead { margin: .1em 0 0; font-size: 1.45em; font-weight: 600; line-height: 1.3; color: var(--codiscuss-accent, #2563eb); }
|
|
58
|
+
.sub { margin: .25em 0 0; font-size: .88em; color: var(--codiscuss-text-muted, #6b7280); font-variant-numeric: tabular-nums; }
|
|
59
|
+
.ranks { list-style: none; margin: 1em 0 0; padding: 0; display: grid; gap: .55em; }
|
|
60
|
+
.ranks li { display: grid; grid-template-columns: 1.2em 7.2em 1fr 2.4em; gap: .7em; align-items: center; font-size: .95em; }
|
|
61
|
+
.ranks .pos { color: var(--codiscuss-text-hint, #9ca3af); font-size: .8em; text-align: right; }
|
|
62
|
+
.ranks .track { height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--codiscuss-border, #e5e7eb) 70%, transparent); overflow: hidden; }
|
|
63
|
+
.ranks .fill { height: 100%; border-radius: 3px; background: var(--codiscuss-text-hint, #9ca3af); opacity: .7; transition: width .25s ease; }
|
|
64
|
+
.ranks .score { text-align: right; font-variant-numeric: tabular-nums; color: var(--codiscuss-text-muted, #6b7280); }
|
|
65
|
+
.ranks li.win { font-weight: 600; }
|
|
66
|
+
.ranks li.win .fill { background: var(--codiscuss-accent, #2563eb); opacity: 1; }
|
|
67
|
+
.ranks li.win .score { color: inherit; }
|
|
68
|
+
.section { display: flex; align-items: baseline; justify-content: space-between; margin: 1.4em 0 .4em; padding-top: 1em; border-top: 1px solid color-mix(in srgb, var(--codiscuss-border, #e5e7eb) 70%, transparent); }
|
|
69
|
+
.section span { font-size: .78em; letter-spacing: .04em; color: var(--codiscuss-text-hint, #9ca3af); }
|
|
70
|
+
.weights { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1em 1.6em; }
|
|
71
|
+
.weight, .slider, .weight .note { display: block; }
|
|
72
|
+
.weight .head { display: flex; justify-content: space-between; align-items: baseline; }
|
|
73
|
+
.weight .value { font-variant-numeric: tabular-nums; font-weight: 600; }
|
|
74
|
+
.slider { position: relative; height: 22px; margin-top: .2em; }
|
|
75
|
+
.slider .rail, .slider .zone { position: absolute; top: 50%; height: 4px; margin-top: -2px; border-radius: 2px; }
|
|
76
|
+
.slider .rail { left: 0; right: 0; background: color-mix(in srgb, var(--codiscuss-border, #e5e7eb) 80%, transparent); }
|
|
77
|
+
.slider .zone { background: var(--codiscuss-accent, #2563eb); opacity: .4; transition: left .2s ease, width .2s ease; }
|
|
78
|
+
.slider input { position: absolute; inset: 0; width: 100%; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; }
|
|
79
|
+
.slider input::-webkit-slider-runnable-track { height: 22px; background: transparent; }
|
|
80
|
+
.slider input::-moz-range-track { height: 22px; background: transparent; }
|
|
81
|
+
.slider input::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: 4px; border-radius: 50%; background: var(--codiscuss-accent, #2563eb); border: 2px solid var(--codiscuss-card, #fff); box-shadow: 0 0 0 1px var(--codiscuss-accent, #2563eb); }
|
|
82
|
+
.slider input::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--codiscuss-accent, #2563eb); border: 2px solid var(--codiscuss-card, #fff); box-shadow: 0 0 0 1px var(--codiscuss-accent, #2563eb); }
|
|
83
|
+
.slider input:focus-visible { outline: none; }
|
|
84
|
+
.slider input:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 1px var(--codiscuss-accent, #2563eb), 0 0 0 5px color-mix(in srgb, var(--codiscuss-accent, #2563eb) 25%, transparent); }
|
|
85
|
+
.weight .note { margin-top: .15em; font-size: .78em; color: var(--codiscuss-text-hint, #9ca3af); }
|
|
86
|
+
details { margin-top: 1.2em; font-size: .85em; color: var(--codiscuss-text-muted, #6b7280); }
|
|
87
|
+
summary { cursor: pointer; width: fit-content; }
|
|
88
|
+
table { width: 100%; margin-top: .5em; border-collapse: collapse; font-variant-numeric: tabular-nums; }
|
|
89
|
+
th, td { padding: .3em .4em; text-align: left; border-bottom: 1px solid color-mix(in srgb, var(--codiscuss-border, #e5e7eb) 70%, transparent); font-weight: 400; }
|
|
90
|
+
th { color: var(--codiscuss-text-hint, #9ca3af); }
|
|
91
|
+
.basis { margin: .5em 0 0; line-height: 1.6; }
|
|
92
|
+
.foot { display: flex; gap: 1em; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 1.2em; }
|
|
93
|
+
.foot .hint { font-size: .82em; color: var(--codiscuss-text-hint, #9ca3af); }
|
|
94
|
+
.primary { border-color: var(--codiscuss-accent, #2563eb) !important; background: var(--codiscuss-accent, #2563eb) !important; color: #fff; padding: .4em 1em !important; }
|
|
95
|
+
.primary:hover { filter: brightness(1.08); }
|
|
96
|
+
</style>
|
|
97
|
+
<div class="wrap">
|
|
98
|
+
<p class="eyebrow">按你的权重,主持人最适合</p>
|
|
99
|
+
<p class="lead" id="winner"></p>
|
|
100
|
+
<p class="sub" id="margin"></p>
|
|
101
|
+
<ol class="ranks" id="ranks" aria-label="加权得分排名"></ol>
|
|
102
|
+
|
|
103
|
+
<div class="section"><span>你的权重</span><span>浅色区间内拖动,第一名不变</span></div>
|
|
104
|
+
<div class="weights" id="weights"></div>
|
|
105
|
+
|
|
106
|
+
<details>
|
|
107
|
+
<summary>得分与依据</summary>
|
|
108
|
+
<table id="table"></table>
|
|
109
|
+
<p class="basis">质量、省钱、速度按成员分工参考里的公开跑分、每套题成本与耗时折算;中文表达按你的使用经验:Codex 中文偏防御腔,Gemini 排版差。都是主观折算,结论只在这组得分成立时成立。</p>
|
|
110
|
+
</details>
|
|
111
|
+
|
|
112
|
+
<div class="foot">
|
|
113
|
+
<span class="hint" id="hint">满分 10 分,按权重加权平均</span>
|
|
114
|
+
<button id="submit" class="primary" type="button">按这组权重交给主持人</button>
|
|
115
|
+
</div>
|
|
116
|
+
</div>
|
|
117
|
+
<script>
|
|
118
|
+
const CRITERIA = [
|
|
119
|
+
{ key: "quality", label: "质量", weight: 5 },
|
|
120
|
+
{ key: "cost", label: "省钱", weight: 1 },
|
|
121
|
+
{ key: "speed", label: "速度", weight: 1 },
|
|
122
|
+
{ key: "chinese", label: "中文表达", weight: 3 },
|
|
123
|
+
];
|
|
124
|
+
const OPTIONS = [
|
|
125
|
+
{ label: "Opus 5.5", scores: { quality: 9, cost: 3, speed: 4, chinese: 9 } },
|
|
126
|
+
{ label: "Sonnet 5.5", scores: { quality: 7.5, cost: 5, speed: 4, chinese: 8 } },
|
|
127
|
+
{ label: "GPT-6.2 Sol", scores: { quality: 7.5, cost: 9.5, speed: 7.5, chinese: 5 } },
|
|
128
|
+
{ label: "Gemini Neon", scores: { quality: 8.5, cost: 8.5, speed: 9, chinese: 6.5 } },
|
|
129
|
+
];
|
|
130
|
+
const MAX_WEIGHT = 10, STEP = 0.1;
|
|
131
|
+
const $ = (id) => document.getElementById(id);
|
|
132
|
+
|
|
133
|
+
function ranking(weights) {
|
|
134
|
+
const total = Object.values(weights).reduce((sum, value) => sum + value, 0) || 1;
|
|
135
|
+
return OPTIONS.map((option) => ({
|
|
136
|
+
label: option.label,
|
|
137
|
+
score: CRITERIA.reduce((sum, item) => sum + option.scores[item.key] * weights[item.key], 0) / total,
|
|
138
|
+
})).sort((left, right) => right.score - left.score);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** The range of one weight, the others held, in which the current first place stays first. */
|
|
142
|
+
function stable_range(weights, key, winner) {
|
|
143
|
+
let low = null, high = null;
|
|
144
|
+
for (let value = 0; value <= MAX_WEIGHT + 1e-9; value += STEP) {
|
|
145
|
+
if (ranking({ ...weights, [key]: value })[0].label !== winner) continue;
|
|
146
|
+
if (low === null) low = value;
|
|
147
|
+
high = value;
|
|
148
|
+
}
|
|
149
|
+
return [low ?? 0, high ?? 0];
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const current = () => Object.fromEntries(CRITERIA.map((item) => [item.key, Number($("w-" + item.key).value)]));
|
|
153
|
+
|
|
154
|
+
$("weights").innerHTML = CRITERIA.map((item) => `<label class="weight">
|
|
155
|
+
<span class="head"><span>${item.label}</span><span class="value" id="o-${item.key}"></span></span>
|
|
156
|
+
<span class="slider"><span class="rail"></span><span class="zone" id="z-${item.key}"></span>
|
|
157
|
+
<input id="w-${item.key}" type="range" min="0" max="${MAX_WEIGHT}" step="1" value="${item.weight}" aria-label="${item.label}的权重"></span>
|
|
158
|
+
<span class="note" id="n-${item.key}"></span></label>`).join("");
|
|
159
|
+
$("table").innerHTML = `<tr><th>方案</th>${CRITERIA.map((item) => `<th>${item.label}</th>`).join("")}</tr>`
|
|
160
|
+
+ OPTIONS.map((option) => `<tr><td>${option.label}</td>${CRITERIA.map((item) => `<td>${option.scores[item.key]}</td>`).join("")}</tr>`).join("");
|
|
161
|
+
|
|
162
|
+
function render() {
|
|
163
|
+
const weights = current(), ranked = ranking(weights), winner = ranked[0].label;
|
|
164
|
+
$("winner").textContent = winner;
|
|
165
|
+
$("margin").textContent = `${ranked[0].score.toFixed(2)} 分,领先 ${ranked[1].label} ${(ranked[0].score - ranked[1].score).toFixed(2)} 分`;
|
|
166
|
+
$("ranks").replaceChildren(...ranked.map((entry, index) => {
|
|
167
|
+
const row = document.createElement("li");
|
|
168
|
+
row.className = index === 0 ? "win" : "";
|
|
169
|
+
row.innerHTML = `<span class="pos">${index + 1}</span><span></span><span class="track"><span class="fill" style="display:block;width:${entry.score * 10}%"></span></span><span class="score">${entry.score.toFixed(1)}</span>`;
|
|
170
|
+
row.children[1].textContent = entry.label;
|
|
171
|
+
return row;
|
|
172
|
+
}));
|
|
173
|
+
for (const item of CRITERIA) {
|
|
174
|
+
$("o-" + item.key).textContent = weights[item.key];
|
|
175
|
+
const [low, high] = stable_range(weights, item.key, winner);
|
|
176
|
+
const zone = $("z-" + item.key);
|
|
177
|
+
zone.style.left = low / MAX_WEIGHT * 100 + "%";
|
|
178
|
+
zone.style.width = Math.max((high - low) / MAX_WEIGHT * 100, 1.5) + "%";
|
|
179
|
+
$("n-" + item.key).textContent = high - low >= MAX_WEIGHT - STEP ? "怎么调都不影响第一名" : `${low.toFixed(1)} – ${high.toFixed(1)} 之间不变`;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
CRITERIA.forEach((item) => { $("w-" + item.key).oninput = render; });
|
|
184
|
+
$("submit").onclick = () => {
|
|
185
|
+
const weights = current(), ranked = ranking(weights);
|
|
186
|
+
const text = `权重:${CRITERIA.map((item) => `${item.label} ${weights[item.key]}`).join("、")}。主持人选 ${ranked[0].label}(${ranked[0].score.toFixed(2)} 分,领先 ${ranked[1].label} ${(ranked[0].score - ranked[1].score).toFixed(2)} 分;得分为主观折算)。`;
|
|
187
|
+
window.codiscuss.submit(text, { weights, ranking: ranked });
|
|
188
|
+
};
|
|
189
|
+
if (!window.codiscuss?.submit) {
|
|
190
|
+
$("submit").hidden = true;
|
|
191
|
+
$("hint").textContent = "这里不能直接提交,请把四个权重和选择打字回复";
|
|
192
|
+
}
|
|
193
|
+
render();
|
|
194
|
+
</script>
|
|
195
|
+
```
|
|
196
|
+
````
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
1. 保存有原文依据的最终判断、state 与简报(`until` 须覆盖实际读过的最新材料);需要留主持说明时按参与技能写入。主持说明本身不结束讨论。
|
|
15
15
|
2. `room conclusion ROOM` 申请收束状态,得到阻碍项 `blockers` 与 `revision`。
|
|
16
|
-
3. 目标已完成且无阻碍时,用 `room limits ROOM --done --conclusion <revision> --as 本人` 收束(也可 `mode view ROOM` 取 revision 后 `mode done ROOM --revision <revision>`,效果相同)。到限则用 `room limits ROOM --check --as 本人`。有未处理留言、state 落后或仍有排队安排会被拒绝;状态变化后 revision
|
|
16
|
+
3. 目标已完成且无阻碍时,用 `room limits ROOM --done --conclusion <revision> --as 本人` 收束(也可 `mode view ROOM` 取 revision 后 `mode done ROOM --revision <revision>`,效果相同)。到限则用 `room limits ROOM --check --as 本人`。有未处理留言、state 落后或仍有排队安排会被拒绝;状态变化后 revision 失效需重取。成功后讨论结束,本次执行随之完成,不再补 chat 回执。
|
|
17
|
+
4. 讨论期间用户交代了“讨论结束后”要做的事(派人实现、测试、写文档等)时,收束时加 `--continue "继续做什么"`:讨论结束、房间空闲后程序再唤醒你一次,届时按普通房间请求派活。不带它就没有人会再唤醒你,回过一句“收到”不算交接。
|
|
17
18
|
|
|
18
19
|
最终总结按议题组织结论、不同意见、重要条件与未验证影响,不强制固定栏目。用户要求独立报告时再调用仓库的 discuss-report,报告不表示建议已获采纳。
|
package/README.md
CHANGED
|
@@ -36,6 +36,7 @@ The [User Guide](docs/en/guide/README.md) covers each of these in full.
|
|
|
36
36
|
- **Smart Scheduling** — optionally let a decision model handle routine routing instead of waking the host; it uses your own key, and the room title and recent messages are sent to the provider. See [Smart Scheduling](docs/en/guide/scheduling.md).
|
|
37
37
|
- **Mix any participant** — local CLIs and desktop apps, model APIs and manually connected sessions in one room; resume existing agent sessions and give each member read-only or writable access. See [Members](docs/en/guide/members.md).
|
|
38
38
|
- **Shared projects and records** — point a room at project folders and browse them; attachments, export and import between sites, and branching; destroy a room, with its members’ AI sessions, at any time or after a set idle period. See [Rooms](docs/en/guide/rooms.md).
|
|
39
|
+
- **Deploy as website** — publish a page or built folder a member made to a public address for 7 days, renewable, after you confirm what goes out. See [Working in a room](docs/en/guide/working.md#8-deploy-a-page-as-a-website).
|
|
39
40
|
- **Borrow an AI from another computer** — bring an agent on someone else's computer into your room, reading only the folders you open, revocable at any time. See [External members](docs/en/guide/external-members.md).
|
|
40
41
|
- **Phone and away from your desk** — once your computer is bound to your own free Cloudflare site, pair a phone or tablet by scanning a code. See [Phone and remote use](docs/en/guide/remote.md).
|
|
41
42
|
- **Voice and hosting** — read-aloud and voice input, which can run locally; the admin panel can create hosted accounts for others. See [Voice and notifications](docs/en/guide/voice.md) and [Admin panel and hosted accounts](docs/en/guide/admin.md).
|
package/README.zh-CN.md
CHANGED
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
- **智能调度**:可选由决策模型处理日常分派,不必每次唤醒主持人;使用你自己的密钥,房间标题与最近消息会发给所选供应商。见[智能调度](docs/guide/scheduling.md)。
|
|
37
37
|
- **混合接入**:本地 CLI 与桌面 App、模型 API、手动接入的会话同房协作;可续接已有的 AI 会话,为每位成员设置只读或可写。见[成员](docs/guide/members.md)。
|
|
38
38
|
- **共享项目与记录**:为房间指定项目目录并在“文件”页浏览;附件、跨站点导出导入与分支;房间可随时或按设定期限销毁,连同成员的 AI 会话记录一起删除。见[房间目录与建房](docs/guide/rooms.md)。
|
|
39
|
+
- **部署为网站**:把成员做出的网页或构建好的目录发布到公网地址,确认上传内容后上线,有效 7 天、可续期。见[在房间里干活](docs/guide/working.md#8-把网页部署成网站)。
|
|
39
40
|
- **借用另一台电脑上的 AI**:把别人电脑上的 AI 请进你的房间,只读你开放的目录,随时撤销。见[跨电脑协作](docs/guide/external-members.md)。
|
|
40
41
|
- **手机与外出**:电脑绑定自托管的免费 Cloudflare 站点后,手机或平板扫码配对即可远程使用。见[手机与外出](docs/guide/remote.md)。
|
|
41
42
|
- **语音与托管**:朗读与语音输入,可在本机运行;管理面板可给别人开托管账号。见[语音与通知](docs/guide/voice.md)、[管理面板与托管账号](docs/guide/admin.md)。
|
package/backend/free_room.py
CHANGED
|
@@ -44,8 +44,9 @@ ADOPT_REASON_LIMIT = 500
|
|
|
44
44
|
RECENT_EXECUTIONS = 100
|
|
45
45
|
# Upper bound for an open-ended message id range.
|
|
46
46
|
MAX_MESSAGE_ID = 2 ** 63 - 1
|
|
47
|
-
# The timeline page reads this many recent executions
|
|
48
|
-
#
|
|
47
|
+
# The timeline page reads this many recent executions per call; with `after` (?3) only those running or ended since, with
|
|
48
|
+
# `before` (?4) the page of executions older than that id, so the page can reach back to the room's first execution.
|
|
49
|
+
# Parameters: ?1 room, ?2 limit, ?3 after (0 reads all), ?4 before (0 reads the latest).
|
|
49
50
|
TIMELINE_EXECUTIONS = 100
|
|
50
51
|
# The event log page reads at most this many room events per call, newest first when paging back.
|
|
51
52
|
ROOM_EVENT_PAGE = 500
|
|
@@ -73,7 +74,8 @@ CHAIN_USED_SQL = """SELECT (SELECT COUNT(*) FROM free_batches f WHERE f.room_id=
|
|
|
73
74
|
SELECT 1 FROM free_relay_steps s WHERE s.room_id=f.room_id AND s.batch_id=f.batch_id))
|
|
74
75
|
+ (SELECT COUNT(*) FROM free_host_wakes WHERE room_id=?1 AND chain_id=?2 AND key LIKE 'continue:%')"""
|
|
75
76
|
TIMELINE_STATES = {"completed": "done", "failed": "failed", "cancelled": "cancelled"}
|
|
76
|
-
TIMELINE_FREE_IDS = "SELECT id FROM member_executions WHERE room_id=?1 AND (?3=0 OR finished_at=0 OR finished_at>=?3)
|
|
77
|
+
TIMELINE_FREE_IDS = """SELECT id FROM member_executions WHERE room_id=?1 AND (?3=0 OR finished_at=0 OR finished_at>=?3)
|
|
78
|
+
AND (?4=0 OR id<?4) ORDER BY id DESC LIMIT ?2"""
|
|
77
79
|
# Besides times: the task an execution took on (its request message), its result (the answer's summary, else the
|
|
78
80
|
# answer's opening), its latest progress note, how many files it changed (NULL when unobserved) and its last output time.
|
|
79
81
|
TIMELINE_SQL = f"""SELECT x.*,(SELECT COALESCE(NULLIF(s.text,''),substr(a.text,1,200)) FROM messages a
|
|
@@ -93,6 +95,12 @@ TIMELINE_SQL = f"""SELECT x.*,(SELECT COALESCE(NULLIF(s.text,''),substr(a.text,1
|
|
|
93
95
|
FROM member_executions e JOIN room_members m ON m.id=e.member_id WHERE e.id IN ({TIMELINE_FREE_IDS})) x"""
|
|
94
96
|
TIMELINE_SEGMENTS_SQL = f"""SELECT source,execution_id,phase,tool,start_ms,end_ms FROM execution_segments WHERE room_id=?1
|
|
95
97
|
AND source='free' AND execution_id IN ({TIMELINE_FREE_IDS}) ORDER BY source,execution_id,seq"""
|
|
98
|
+
# Each execution's time per phase, where its first phase began and how many phases it reported: enough for the timeline's
|
|
99
|
+
# labels, waits and overviews while the phases themselves are read for the rows in view (#8131).
|
|
100
|
+
TIMELINE_PHASES_SQL = f"""SELECT execution_id,phase,SUM(MAX(0,end_ms-start_ms)) AS ms,MIN(start_ms) AS first_ms,COUNT(*) AS count
|
|
101
|
+
FROM execution_segments WHERE room_id=?1 AND source='free' AND execution_id IN ({TIMELINE_FREE_IDS}) GROUP BY execution_id,phase"""
|
|
102
|
+
# Phases asked for by execution, at most this many executions per read.
|
|
103
|
+
TIMELINE_SEGMENT_IDS = 200
|
|
96
104
|
# Only the times of progress notes: the texts are read when the reader hovers one.
|
|
97
105
|
TIMELINE_NOTES_SQL = f"""SELECT execution_id,created_at FROM execution_notes
|
|
98
106
|
WHERE room_id=?1 AND execution_id IN ({TIMELINE_FREE_IDS}) ORDER BY execution_id,seq"""
|
|
@@ -826,31 +834,70 @@ def execution_notes(connection, room_id, execution_id, token=""):
|
|
|
826
834
|
return {"notes": notes}
|
|
827
835
|
|
|
828
836
|
|
|
829
|
-
def execution_timeline(connection, room_id, after=0):
|
|
837
|
+
def execution_timeline(connection, room_id, after=0, before=0, full=True):
|
|
830
838
|
"""Read the room's recent executions with their phase segments and note times, for the timeline page.
|
|
831
839
|
|
|
832
840
|
Times are epoch seconds and segments are millisecond offsets from `dispatched_at`. An execution's parent is the
|
|
833
841
|
execution that wrote the message it answers; `task_author` wrote the message that started it ("用户" for the owner),
|
|
834
842
|
which the page needs to tell a new request from the room's own follow-ups. `state` is running, done, failed
|
|
835
843
|
or cancelled, so the page never interprets execution statuses itself. A positive `after` reads only executions
|
|
836
|
-
still running or ended since then, so a page following live work rereads little
|
|
844
|
+
still running or ended since then, so a page following live work rereads little; a positive `before` reads the
|
|
845
|
+
page of executions older than that id, and `earlier` says whether still older ones exist.
|
|
846
|
+
|
|
847
|
+
Every execution also carries `phases` (milliseconds per phase), `first_ms` (where its first phase began) and
|
|
848
|
+
`segment_count`. With `full` false a whole read leaves the phase segments out except for running executions, and
|
|
849
|
+
the page reads them for the rows it shows (`execution_segments`); 86% of a 100-execution read was segments (#8131).
|
|
850
|
+
An incremental read (`after`) always carries them, as it holds only live and just-ended work.
|
|
837
851
|
"""
|
|
838
852
|
if not connection.execute("SELECT 1 FROM rooms WHERE id=?", (room_id,)).fetchone():
|
|
839
853
|
raise LookupError(Text("房间不存在"))
|
|
840
|
-
params = (room_id, TIMELINE_EXECUTIONS, max(0, int(after)))
|
|
854
|
+
params = (room_id, TIMELINE_EXECUTIONS, max(0, int(after)), max(0, int(before)))
|
|
841
855
|
rows = [dict(row) for row in connection.execute(TIMELINE_SQL, params)]
|
|
842
|
-
segments, notes = {}, {}
|
|
856
|
+
segments, notes, phases = {}, {}, {}
|
|
857
|
+
running = {row["id"] for row in rows if row["status"] not in TIMELINE_STATES}
|
|
858
|
+
with_segments = full or bool(params[2])
|
|
859
|
+
for row in connection.execute(TIMELINE_PHASES_SQL, params):
|
|
860
|
+
entry = phases.setdefault(row["execution_id"], {"phases": {}, "first_ms": None, "segment_count": 0})
|
|
861
|
+
entry["phases"][row["phase"]] = row["ms"]
|
|
862
|
+
entry["first_ms"] = row["first_ms"] if entry["first_ms"] is None else min(entry["first_ms"], row["first_ms"])
|
|
863
|
+
entry["segment_count"] += row["count"]
|
|
843
864
|
for row in connection.execute(TIMELINE_SEGMENTS_SQL, params):
|
|
865
|
+
if not with_segments and row["execution_id"] not in running:
|
|
866
|
+
continue
|
|
844
867
|
segments.setdefault((row["source"], row["execution_id"]), []).append(
|
|
845
868
|
{key: row[key] for key in ("phase", "tool", "start_ms", "end_ms")})
|
|
846
869
|
for row in connection.execute(TIMELINE_NOTES_SQL, params):
|
|
847
870
|
notes.setdefault(row["execution_id"], []).append(row["created_at"])
|
|
848
871
|
for row in rows:
|
|
849
872
|
row["state"] = TIMELINE_STATES.get(row["status"], "running")
|
|
850
|
-
row
|
|
873
|
+
row.update(phases.get(row["id"], {"phases": {}, "first_ms": None, "segment_count": 0}))
|
|
874
|
+
if with_segments or row["id"] in running:
|
|
875
|
+
row["segments"] = segments.get((row["source"], row["id"]), [])
|
|
851
876
|
row["notes"] = notes.get(row["id"], [])
|
|
877
|
+
oldest = min((row["id"] for row in rows), default=0)
|
|
878
|
+
earlier = bool(oldest) and not params[2] and connection.execute(
|
|
879
|
+
"SELECT 1 FROM member_executions WHERE room_id=? AND id<? LIMIT 1", (room_id, oldest)).fetchone() is not None
|
|
852
880
|
return {"now": int(time.time()), "after": params[2], "executions": rows, "execution_limit": TIMELINE_EXECUTIONS,
|
|
853
|
-
"segment_limit": MAX_EXECUTION_SEGMENTS}
|
|
881
|
+
"segment_limit": MAX_EXECUTION_SEGMENTS, "earlier": earlier}
|
|
882
|
+
|
|
883
|
+
|
|
884
|
+
def execution_segments(connection, room_id, ids):
|
|
885
|
+
"""The phase segments of the room's executions named in `ids` (at most TIMELINE_SEGMENT_IDS), by execution id.
|
|
886
|
+
|
|
887
|
+
Each segment is `[phase, tool, start_ms, end_ms]`, offsets from the execution's delivery as in the timeline; the
|
|
888
|
+
page asks for the rows it shows (#8131). Ids of other rooms' executions are left out.
|
|
889
|
+
"""
|
|
890
|
+
wanted = sorted({int(item) for item in ids if str(item).strip().isdigit()})[:TIMELINE_SEGMENT_IDS]
|
|
891
|
+
result = {str(execution_id): [] for execution_id in wanted}
|
|
892
|
+
if not wanted:
|
|
893
|
+
return {"segments": result}
|
|
894
|
+
marks = ",".join("?" * len(wanted))
|
|
895
|
+
owned = {row[0] for row in connection.execute(f"SELECT id FROM member_executions WHERE room_id=? AND id IN ({marks})", (room_id, *wanted))}
|
|
896
|
+
for row in connection.execute(f"""SELECT execution_id,phase,tool,start_ms,end_ms FROM execution_segments
|
|
897
|
+
WHERE source='free' AND execution_id IN ({marks}) ORDER BY execution_id,seq""", wanted):
|
|
898
|
+
if row["execution_id"] in owned:
|
|
899
|
+
result[str(row["execution_id"])].append([row["phase"], row["tool"], row["start_ms"], row["end_ms"]])
|
|
900
|
+
return {"segments": {key: value for key, value in result.items() if int(key) in owned}}
|
|
854
901
|
|
|
855
902
|
|
|
856
903
|
def room_event_log(connection, room_id, token, after=0, before=0):
|
package/backend/mode_room.py
CHANGED
|
@@ -103,6 +103,6 @@ def finish_mode(connection, room_id, token, payload):
|
|
|
103
103
|
if mode["mode"] == "discussion":
|
|
104
104
|
if require_member(connection, room_id, token)["role"] != "host":
|
|
105
105
|
raise PermissionError(Text("只有主持人能宣告讨论完成"))
|
|
106
|
-
conclude_session_by_host(connection, room_id, {"conclusion": payload.get("revision")})
|
|
106
|
+
conclude_session_by_host(connection, room_id, {"conclusion": payload.get("revision"), "continue": payload.get("continue")})
|
|
107
107
|
return mode_view(connection, room_id)
|
|
108
108
|
raise FileExistsError(Text("房间没有进行中的 Goal 或讨论"))
|
package/backend/schema.sql
CHANGED
|
@@ -437,6 +437,7 @@ CREATE TABLE IF NOT EXISTS member_requests (
|
|
|
437
437
|
);
|
|
438
438
|
CREATE INDEX IF NOT EXISTS member_requests_open ON member_requests(member_id,status);
|
|
439
439
|
CREATE INDEX IF NOT EXISTS member_requests_execution ON member_requests(execution_id);
|
|
440
|
+
CREATE INDEX IF NOT EXISTS member_requests_answer ON member_requests(answer_id);
|
|
440
441
|
CREATE INDEX IF NOT EXISTS member_requests_room ON member_requests(room_id);
|
|
441
442
|
CREATE INDEX IF NOT EXISTS member_requests_room_status ON member_requests(room_id,status);
|
|
442
443
|
CREATE INDEX IF NOT EXISTS member_requests_batch ON member_requests(batch_id,status);
|
|
@@ -1964,3 +1965,48 @@ CREATE TABLE IF NOT EXISTS interjection_authors (
|
|
|
1964
1965
|
interjection_id INTEGER PRIMARY KEY REFERENCES execution_interjections(id) ON DELETE CASCADE,
|
|
1965
1966
|
author TEXT NOT NULL
|
|
1966
1967
|
);
|
|
1968
|
+
-- Staged local directories/files ready to deploy to the public sites host; written only by local runner commands.
|
|
1969
|
+
CREATE TABLE IF NOT EXISTS room_site_stages (
|
|
1970
|
+
id TEXT PRIMARY KEY,
|
|
1971
|
+
room_id TEXT NOT NULL REFERENCES rooms(id) ON DELETE CASCADE,
|
|
1972
|
+
execution_id INTEGER,
|
|
1973
|
+
message_id INTEGER,
|
|
1974
|
+
member TEXT NOT NULL DEFAULT '',
|
|
1975
|
+
title TEXT NOT NULL DEFAULT '',
|
|
1976
|
+
directory TEXT NOT NULL DEFAULT '',
|
|
1977
|
+
kind TEXT NOT NULL DEFAULT 'directory' CHECK (kind IN ('directory', 'file')),
|
|
1978
|
+
file_count INTEGER NOT NULL DEFAULT 0,
|
|
1979
|
+
bytes INTEGER NOT NULL DEFAULT 0,
|
|
1980
|
+
files_json TEXT NOT NULL DEFAULT '[]',
|
|
1981
|
+
spots_json TEXT NOT NULL DEFAULT '[]',
|
|
1982
|
+
rejected_json TEXT NOT NULL DEFAULT '[]',
|
|
1983
|
+
ready INTEGER NOT NULL DEFAULT 1 CHECK (ready IN (0, 1)),
|
|
1984
|
+
site_id TEXT NOT NULL DEFAULT '',
|
|
1985
|
+
created_at TEXT NOT NULL,
|
|
1986
|
+
updated_at TEXT NOT NULL
|
|
1987
|
+
);
|
|
1988
|
+
CREATE INDEX IF NOT EXISTS room_site_stages_room ON room_site_stages(room_id, updated_at DESC);
|
|
1989
|
+
CREATE INDEX IF NOT EXISTS room_site_stages_exec ON room_site_stages(room_id, execution_id);
|
|
1990
|
+
-- Public metadata of deployed websites (never stores device_token or absolute local paths).
|
|
1991
|
+
CREATE TABLE IF NOT EXISTS room_sites (
|
|
1992
|
+
site_id TEXT PRIMARY KEY,
|
|
1993
|
+
room_id TEXT NOT NULL REFERENCES rooms(id) ON DELETE CASCADE,
|
|
1994
|
+
message_id INTEGER,
|
|
1995
|
+
execution_id INTEGER,
|
|
1996
|
+
member TEXT NOT NULL DEFAULT '',
|
|
1997
|
+
title TEXT NOT NULL DEFAULT '',
|
|
1998
|
+
url TEXT NOT NULL,
|
|
1999
|
+
directory TEXT NOT NULL DEFAULT '',
|
|
2000
|
+
current_version INTEGER NOT NULL DEFAULT 1,
|
|
2001
|
+
previous_version INTEGER NOT NULL DEFAULT 0,
|
|
2002
|
+
file_count INTEGER NOT NULL DEFAULT 0,
|
|
2003
|
+
bytes INTEGER NOT NULL DEFAULT 0,
|
|
2004
|
+
status TEXT NOT NULL DEFAULT 'active' CHECK (status IN ('active', 'expired', 'taken_down', 'revoked')),
|
|
2005
|
+
versions_json TEXT NOT NULL DEFAULT '[]',
|
|
2006
|
+
files_json TEXT NOT NULL DEFAULT '[]',
|
|
2007
|
+
expires_at TEXT NOT NULL DEFAULT '',
|
|
2008
|
+
created_at TEXT NOT NULL,
|
|
2009
|
+
updated_at TEXT NOT NULL
|
|
2010
|
+
);
|
|
2011
|
+
CREATE INDEX IF NOT EXISTS room_sites_room ON room_sites(room_id, updated_at DESC);
|
|
2012
|
+
CREATE INDEX IF NOT EXISTS room_sites_status ON room_sites(status, expires_at);
|