kicer
e489fc68eb
system-prompt: 更新能力边界,把生成式媒体从 out-of-scope 移到 in-scope
...
之前 prompt 把"文生图/AI 绘画/AI 视频生成"明确列为 out of scope 并要求 AI
把这类请求直接推给第三方工具(豆包/即梦等)。但当前环境已经接入
generate_image 和 generate_video 两个 MCP 服务,这些能力实际上是 in scope
的。原 prompt 会让 AI 把可以做的事推到外面去。
本次调整:
- in scope 增加一条:"通过当前会话可用的 MCP 工具做生成式媒体",
并明确工具自己的 description 是参数/限制的唯一可信来源。
- out of scope 收窄到当前 MCP 实际未覆盖的能力(音频/3D/风格化/
换脸/抠图等——具体哪条要看 tools/list)。这样以后再加/减 MCP,
prompt 不用动。
- "如何应对 out of scope" 的措辞调整:仍然推荐第三方作为兜底,
但语气从"主动推荐"改成"如果合适就提一句"。
不写死任何 MCP 工具名,prompt 保持配置无关——前缀缓存仍然按
system-prompt.txt 整体对齐。
2026-09-04 21:38:29 +08:00
kicer
daaa01878d
video-gen: auto-expire uploaded files older than UPLOAD_TTL_HOURS
...
Adds cleanupUploads(): on startup and every hour, deletes files in
UPLOAD_DIR whose mtime is older than UPLOAD_TTL_HOURS (default 24).
Uses fs.promises + parallel stat/unlink, unref() the interval so it
never blocks process shutdown, ignore ENOENT races silently.
Storage is multer diskStorage so memory never holds a full file body,
but disk could grow without bound if uploads pile up unused. This
bounds the disk footprint without requiring a manual cron, and keeps
the 'temp upload' semantics: the URL is meant to be consumed within
the same session anyway.
README: document UPLOAD_TTL_HOURS / UPLOAD_DIR env vars, add design
note for the cleanup loop.
2026-09-04 21:34:24 +08:00
kicer
e378ad001f
video-gen: add /upload endpoint for local image upload
...
Adds POST /upload (multer diskStorage, max 8MB, image/* only) returning
a public URL under /uploads/* that can be passed directly to
generate_video.image_url. Uploads live in container temp storage and
are discarded on restart (no persistence, no auth).
generate_video tool description is now built at startup with the real
upload URL baked in (resolved from PUBLIC_BASE_URL env, falls back to
http://localhost :<port>) so the AI sees an exact curl command and
doesn't have to guess the host.
docker-compose: set PUBLIC_BASE_URL=https://video-gen.ai.foresh.com
README: new upload section, reverse-proxy note, FAQ entries
2026-09-04 20:58:51 +08:00
kicer
8ac62bedd9
mcp: 兼容 session 过期,自动重新握手
...
某些 MCP 服务在长时间空闲后会主动让旧 session 失效,下次非 initialize
请求会返回 400 并提示 missing/invalid Mcp-Session-Id。之前 mcp.js 一直
复用启动时缓存的 server.sessionId,会持续报错。
本次在 rpc() 出口处加一个最小补偿:仅当 method 不是 initialize、状态码
是 400、错误体含 'session' 时,清掉旧 id、重新跑 initialize +
notifications/initialized、再重试一次原请求。initialize 调用走当前函数
的 method !== 'initialize' 分支天然不会带旧 header,递归链路自动终止
在 initialize 那一层(不会无限循环)。
工具表(toolDefs / toolIndex)保持 init() 时的快照不变——session 重连
只换 id,不动工具表,避免工具集差异导致调用方混淆。重连失败或重连后
仍然 400 时原样向上抛错,由调用方决定如何应对。
2026-09-04 20:50:59 +08:00
kicer
cb780cfb0b
本地化 marked 渲染器:md 预览不再依赖 CDN,离线/内网环境也能正常渲染
2026-09-04 16:56:18 +08:00
kicer
710200605b
add video-gen support
2026-09-04 16:19:34 +08:00
kicer
47f7172a32
忽略技能目录下的 __pycache__
2026-09-04 16:00:45 +08:00
kicer
e3972fb25a
md2pdf技能支持Markdown表格渲染
2026-09-04 15:59:23 +08:00
kicer
e150e9c6c9
md2pdf添加图片功能支持
2026-09-04 15:16:10 +08:00
kicer
ee2fc36ffd
任务文件窗口按时间倒序排列
2026-09-04 15:04:08 +08:00
kicer
66bb97fcdf
修复批量下载手机端文件名错乱/套壳 App 无反应:放弃 blob 方案,先批量拿 token 再用服务器直链触发
...
- blob: URL 手机浏览器不认下载名(变编号/.bin),WebView 套壳不处理 blob 下载请求
- 回到与单文件下载一致的直链路径:文件名跟服务端 Content-Disposition / download-name 兜底
- 所有 download-token 先全部拿到再逐个 <a> 触发,规避首个导航打断后续 fetch(原第 2 个失败的根因)
- 逐个触发间隔 350ms,避免移动端拦截连续多次下载
2026-09-04 14:27:05 +08:00
kicer
1023ffa8fd
修复 MCP 工具调用 400:image-gen 等严格服务要求 initialize 后的请求带 Mcp-Session-Id。
...
init() 阶段先发 initialize 拿 session id 并缓存到 server.sessionId;
rpc() 在 method !== 'initialize' 且 server.sessionId 存在时自动加上 Mcp-Session-Id 头;
老服务(无 initialize 或不返回 session id)保持原行为不受影响
2026-09-04 13:17:23 +08:00
kicer
44da1dcf08
翻译成简单英语方便AI理解
2026-09-04 13:04:25 +08:00
kicer
c1eac96db1
i18n(image-gen): translate remaining AI-facing response text to English
...
Translate the four remaining content.text strings in the tool callback:
- 'no URL returned' error
- success summary (Model / Prompt / Image N)
- generation failure error
- error detail label
Style follows the short-sentence convention from baa04d9 (no extra
explanatory notes added).
2026-09-04 12:55:42 +08:00
kicer
bc53ff3129
i18n(image-gen): translate tool description & token-error text to English
...
Translate the four strings introduced in baa04d9 (\u8c03\u6574\u90e8\u5206\u63d0\u793a\u8bcd) to clear English.
Other Chinese strings in this file (success summary, image-N labels, failure detail)
were not changed in that commit and are intentionally left untouched here.
2026-09-04 12:54:33 +08:00
kicer
2455778f4a
Revert "i18n(image-gen): translate AI-facing tool response text to English"
...
This reverts commit 06a9ae7151d47e0486abad1f11353164db377d45.
2026-09-04 12:54:00 +08:00
kicer
a29ffd9aa5
i18n(image-gen): translate AI-facing tool response text to English
...
The tool result content is consumed by AI agents (Claude/Cursor/...).
Converted four user-facing strings to clear English:
- Missing-token error message
- No-URL-in-response error message
- Success summary (added expiry note for AI to act on)
- Generation-failure error message
Code comments and tool description/describes are untouched in this commit.
2026-09-04 12:52:10 +08:00
kicer
594650510b
调整部分提示词
2026-09-04 12:50:30 +08:00
kicer
eba3a3c7ff
fix(image-gen): 从 extra.requestInfo.headers 读取 token & model(修正字段路径)
...
之前 pickToken/pickModel 用的 'extra?.requestInfo?.req?.headers' 多写了一层 '.req',
SDK 实际只有 extra.requestInfo.headers(参见 webStandardStreamableHttp.js buildRequestInfo),
导致 token/model 始终为 null,AI 调用时实际走默认 model 且若未额外修过 token 则报 401。
本提交:
- 取 header 改用 extra.requestInfo.headers
- pickToken/pickModel 签名改为接收 headers 对象(去掉对 req 的依赖)
- Model 仍只在 tools/call 阶段从 header 读取,不存 session
- Model 优先级:header > DEFAULT_MODEL(已删 schema 里的 model 字段,AI 无法误传)
- README 同步更新鉴权与 model 章节
2026-09-04 12:43:23 +08:00
kicer
76aa1aa604
feat(image-gen): 移除 header 传 model 的逻辑,仅保留工具参数 → 兜底默认
...
- 删除 extractModelFromHeaders / X-Image-Gen-Model 等 header 解析路径
- model 优先级简化为单链:arguments.model → DEFAULT_MODEL (CogView-3-Flash)
- 新增 README.md,覆盖启动、客户端配置、工具用法、curl 调试、FAQ
2026-09-04 12:08:54 +08:00
kicer
f7b4e17cfe
add model参数
2026-09-04 11:17:46 +08:00
kicer
b2c683d455
add image-gen server
2026-09-04 11:13:03 +08:00
kicer
e387293f00
init mcp server
2026-09-04 11:11:32 +08:00
kicer
82a0604846
fix css
2026-09-04 10:04:38 +08:00
kicer
2d2134f437
修复底部全选复选框不显示:footer 的勾选 span 缺少 file-check class,导致 inline 元素 width/height/::after 全部失效
2026-09-04 09:59:42 +08:00
kicer
90de9ab086
任务文件全选复选框挪到 footer 左侧:去大圆按钮,改为方角 22×22 复选框,与行内 .file-check 风格统一但可区分
2026-09-04 09:57:23 +08:00
kicer
7e570012d8
任务文件面板加全选/取消全选:header 右侧增加三态切换按钮(+/−/√),与底部批量操作联动
2026-09-04 09:51:52 +08:00
kicer
cedd236dd8
修复任务文件批量下载:改用 fetch+blob 触发下载,避免 window.location.href 在多文件场景被浏览器去重/丢 cookie
2026-09-04 09:50:30 +08:00
kicer
6c4eca89dc
更改文件浏览器样式
2026-09-04 09:44:01 +08:00
kicer
32a23fa5ab
上传百分比改走正常文档流:进度条改为[轨道|百分比]横排,根治文字被裁
2026-09-04 08:53:13 +08:00
kicer
bc903fc885
修复上传进度百分比显示不全:进度轨道去掉 overflow:hidden(填充条自带圆角,无需裁剪)
2026-09-04 08:48:57 +08:00
kicer
98a98198d3
账户页去掉多余的 /api/system/status 请求:用 /api/me 的 404 判定未启用认证
2026-09-04 08:36:28 +08:00
kicer
6e785e826e
登录成功改用 location.replace 跳转并用 pageshow 兜底:历史不留 /login,杜绝侧滑 bfcache 复活登录页
2026-09-04 07:49:33 +08:00
kicer
28e5e50c77
修复滑动页面的bug
2026-09-04 07:45:09 +08:00
kicer
faa1f9e9f0
加入会话创建者字段:建档时记录 req.user,列表按当前用户过滤(未启用认证不过滤)
2026-09-04 07:13:37 +08:00
kicer
45f5995d4d
加入用户密码脱敏功能
2026-09-04 07:12:06 +08:00
kicer
83fdfaea2d
加入助手类型字段
2026-09-04 00:46:22 +08:00
kicer
1a35e23bcc
feat(settings): 设置区页面支持左→右滑动返回上级(跟手位移+滑出动画,等同顶栏返回)
2026-09-04 00:21:16 +08:00
kicer
dacf21d172
ui(models): 分组头模型计数改为 启用数/总数(例 1 / 7) 形式
2026-09-04 00:15:31 +08:00
kicer
f78cd2ee05
fix issues
2026-09-04 00:07:07 +08:00
kicer
20105a2cb2
思考框可以全部展开
2026-09-03 23:56:52 +08:00
kicer
aafad0b8b0
fix(db): ALTER 误塞在 db.exec 模板串里 — 拆出来作独立 JS 语句,免被 SQLite 误解析
2026-09-03 23:47:17 +08:00
kicer
39c46072fa
feat(chat): 解析/存储/发送思考(reasoning 或 reasoning_content) — DB 新增 reasoning 列,SSE 加 reasoning_delta,前端折叠面板
2026-09-03 23:44:52 +08:00
kicer
65ca28072f
feat(models): 配置新增 extra_params/thinking_params — 启停时按模型合并到上游请求体
2026-09-03 22:50:53 +08:00
kicer
495b72c5c3
ui(drawer): 删除 modal 显示会话标题;侧边栏行增加鼠标悬停高亮
2026-09-03 22:24:01 +08:00
kicer
f0badd9d84
fix(engine): bindModel UPDATE 缺 now() 参数 — 5 参数对 6 占位符导致 'Too few parameter values'
2026-09-03 22:18:34 +08:00
kicer
4d11317baa
feat(models): 模型可禁用 — models.enable(默认启用),禁用不进模型池;模型池页加启停开关
2026-09-03 22:09:10 +08:00
kicer
3ba16402a8
fix(engine): 预留绑定模型不再直接置 active — 无待回应消息时绑成 held,首条消息后才开跑
2026-09-03 21:39:21 +08:00
kicer
f669e759d2
feat(ui): 抽屉桌面端 hover 删除按钮 — 鼠标经过行右侧显示垃圾桶,点击弹删除 modal
2026-09-03 21:14:31 +08:00
kicer
b48a2bcf8c
feat(ui): 抽屉删除 — modal 加 checkbox + 滑动到位直接弹 modal
...
1) 删除会话 modal 加「同时删除任务文件夹」勾选框,默认勾选
- HTML 复用现有 .del-dir 样式,加 #confirm-check-wrap #confirm-check
- confirmModal(title, text, okText, danger, opts) 新增 opts.checkbox 支持
勾选状态通过 state._confirmChecked 传出(不破坏现有调用方签名)
- deleteSession 调 confirmModal 时传 checkbox,确认后用 _confirmChecked 决定 ?delete_dir=true/false
2) 移动端右滑到位直接弹删除 modal,不再露大红钮
- onUp 滑到 60+ 直接调 deleteSession(item.dataset.id)
- 起手已 swiped + 右滑回去(moved>=60 但 dx>0):视为滑回去,弹回原位
- 删除大红钮 .conv-del 相关 DOM/CSS 全部清理
3) 桌面端 .conv-del-inline 行为不变(hover/focus 露出,点击弹 modal)
2026-09-03 20:46:58 +08:00