Commit Graph
39 Commits
Author SHA1 Message Date
kicer db27ade2ac 加入预览卡片支持 2026-10-19 09:11:16 +08:00
kicer 4dd51ba18c 优化国内访问问题 2026-10-19 00:23:28 +08:00
kicer 6b40ced355 officecli: 新增 Office 文档 MCP 服务(docx/xlsx/pptx 创建修改 + 浏览器实时预览)
- 零 npm 依赖 node shim:officecli mcp stdio→Streamable HTTP 桥(命令治理/交付取件链)+ watch 槽位 + 预览网关(:3100)
- 二进制不进 git 也不进镜像:entrypoint 容器首启拉取到命名卷 officecli-bin(pin v1.0.157+sha256,每次启动校验;源链 GitHub→gh-proxy,支持自托管镜像覆盖;离线可手工放置,sha 对上就认);clone 后 docker compose up 即完整入口
- server.js 启动自检 fail fast;compose 注册 mcp_officecli(scratch 工作区独立卷,不挂 agent/tasks)
2026-10-18 23:26:27 +08:00
kicer 1fe8945a2d 超时时间改成3分钟 2026-09-24 17:10:48 +08:00
kicer cb090fe8e0 video_task: 上游 submit/query 加 30s 超时,避免上游挂而不回时拖死工具调用 2026-09-24 17:04:55 +08:00
kicer 90395eeefe image_task: 上游同步调用加 120s 超时(AbortSignal.timeout),超时记 FAIL,杜绝僵尸 PROCESSING 任务 2026-09-24 17:04:55 +08:00
kicer 5269dee70d image_task: 改成异步任务形态(op=create/get),对齐 video_task 契约
上游智谱 images 是同步接口,异步语义由服务自维护的进程内任务表模拟:
create 登记 task_id 后把同步调用丢后台执行、立即返回;get 只读本地表。
已完成任务保留 1h、容量上限 1000;容器重启任务丢失,仅限单实例部署。
2026-09-24 17:02:30 +08:00
kicer e54645bf62 image_task: 去掉 size 参数,图片尺寸走上游默认(AI 传错值经常报错) 2026-09-23 08:46:09 +08:00
kicer d799c4f47f 改名:video_gen → video_task(双工具合并为单工具,op=create/get);image_gen → image_task(单工具,op=create)
- header 前缀同步改为 X-Video-Task-* / X-Image-Task-*(方案 B,agent 侧 config.yml 的 headers 需同步更新)
- docker-compose 服务名 / 容器名 / 调试端口变量(VIDEO_TASK_PORT / IMAGE_TASK_PORT)同步改名
- README(根目录与两份服务文档)按新工具形态重写:op 参数表、curl 示例、架构图
2026-09-23 08:30:02 +08:00
kicer ab667c136c 优化重启逻辑 2026-09-22 19:47:03 +08:00
kicer 485a604d2d 移除 PUBLIC_LINK_URL 绕路链路:本地文件取公网 URL 改由 agent 内置工具直发;video_gen 不再透传 size(上游用默认尺寸) 2026-09-17 19:38:05 +08:00
root 6fff0dd936 网络改名:my-app-network → agent-mcp-net(与 agent 侧一致,纯改名) 2026-09-15 22:23:39 +08:00
kicer 8814fcb67a 文档:公网临时链接改为不透明短 ID(/p/<id>)
- 根 README: 图片到智谱的链路图与说明改为短 ID(约 50 字符、纯 ASCII、不带文件名/签名)
- video_gen/README: 同上;补一句“为什么做短”(URL 会留在会话历史每轮重发);过期现象 403 → 404
- video_gen/src/mcp-server.js: 工具描述附近的注释同步
2026-09-15 21:27:51 +08:00
kicer 4300c8e5b4 构建提速:npm 默认走腾讯云镜像(可用 --build-arg NPM_REGISTRY 覆盖)
- image_gen/Dockerfile、video_gen/Dockerfile: 加 ARG NPM_REGISTRY + npm config set registry
  (web_search 零依赖、不需要)
2026-09-15 21:00:02 +08:00
kicer 3e46dd6375 video_gen: 丢掉上传/落盘整套,本地图片改由 agent 内网现签公网链接
- 删除 POST /upload、GET /uploads/*、multer、上传目录与 TTL 清理、公网只读监听(PUBLIC_PORT/3001)
- 删除 UPLOAD_BASE_URL / PUBLIC_BASE_URL / UPLOAD_DIR,改为单一个 PUBLIC_LINK_URL:
  工具描述里给的命令变成 curl -s "<PUBLIC_LINK_URL>?path=<绝对路径>",stdout 即现成 URL
- package.json: 去掉 multer 依赖;Dockerfile: EXPOSE 3000,去掉 3001 与上传说明
- docker-compose.yml: 去掉 ./uploads 挂载与相关 env,只留 PUBLIC_LINK_URL
- .gitignore: 去掉 uploads/
- 文档: 根 README 与 video_gen README 改写「图片怎么到智谱手上」(零拷贝 + 签名链接)
2026-09-15 19:57:45 +08:00
kicer 8f693d0753 部署:video_gen 双监听(全量 3000 内网 / 只读 3001 公网供中转),mcp 默认不占宿主机端口
- video_gen: UPLOAD_BASE_URL(AI 上传,内网)与 PUBLIC_BASE_URL(智谱下载,公网)拆开配置;
  新增 PUBLIC_PORT 公网只读监听,只挂 GET /uploads/*(无 /mcp、无 POST /upload)
- video_gen: 上传目录落到宿主 ./uploads(重启不让已发出的 URL 失效),Dockerfile EXPOSE 3000 3001
- docker-compose: 三个服务默认都不映射宿主机端口(调试用的 ports 注释保留);
  video_gen 配 UPLOAD_BASE_URL/PUBLIC_BASE_URL/PUBLIC_PORT/UPLOAD_DIR + ./uploads 挂载
- .gitignore(新): node_modules/ 与 uploads/
- 文档: 根 README 说明「只开 agent 端口」与图片到智谱的完整链路;三个子 README 同步端口与调试方式
2026-09-15 19:40:53 +08:00
kicer e633f9b7c3 部署:网络改由 agent 侧创建,去掉手动 docker network create
- docker-compose: my-app-network 仍为 external,注释说明依赖 agent 先起
- README: 部署步骤改为「先起 agent(创建网络),再起 mcp」,并说明 mcp 单独先起会报错
2026-09-15 19:17:57 +08:00
kicer ae13be047c 部署:改为 IP:端口直连(无 nginx-proxy),同步文档
- docker-compose: expose 3000 → ports(WEB_SEARCH_PORT/IMAGE_GEN_PORT/VIDEO_GEN_PORT 可覆盖,默认 8081/8082/8083),去掉 VIRTUAL_HOST/VIRTUAL_PORT/CERT_NAME
- video_gen: PUBLIC_BASE_URL 改为环境变量(默认 http://localhost:8083)
- 新增根 README:部署步骤、端口变量、端口暴露范围(8083 需对外,8081/8082 建议只内网)
- image_gen / video_gen / web_search README: 域名 URL 全部改为 IP:端口
2026-09-15 17:54:46 +08:00
kicer cd6d31c24c fix issues 2026-09-15 17:31:50 +08:00
kicer 273bd9b8b0 修正文件夹目录 2026-09-05 20:34:42 +08:00
kicer a673d53c08 web-search: declare numResults as integer with minimum 1 and default 8 2026-09-05 19:24:23 +08:00
kicer 8612c87b24 video-gen: fix query_video task_id description referencing wrong tool name 2026-09-05 19:23:34 +08:00
kicer 4264ed0e39 video-gen: make prompt a required parameter in tool schema 2026-09-05 19:22:29 +08:00
kicer dab3732b50 fix tools name 2026-09-04 22:31:25 +08:00
kicer 88120d61c1 video-gen: drop duration param, restrict image_url to a single URL
The cogvideox-flash API does not accept a duration field — passing
one gets rejected upstream. Remove DEFAULT_DURATION, the
X-Video-Gen-Duration header parser, and the field forwarded to
Zhipu, both in code and README.

image_url was documented as accepting up to 2 URLs for first/last
frame, but the upstream schema only accepts a single string. Tighten
the zod schema to z.string().url().optional() and update README /
FAQ to make the single-URL constraint explicit.
2026-09-04 22:28:39 +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 710200605b add video-gen support 2026-09-04 16:19:34 +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