You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
实际 UI:/imagine a lighthouse at dusk, watercolor → 卡片 Allow Generate image "a lighthouse at dusk, watercolor" via 127.0.0.1:18187? y=allow once n=reject / Sends the prompt to 127.0.0.1:18187. codsh does not know its price; any charge is set by that service. Each image request asks again. → y → Image saved to images/1.png (256x256),Service: 127.0.0.1:18187 (sd-turbo) in 7.1s.
Activity
feat(rust): image generation and editing services (ticket 55 / #187)
Blackman99 commentedon Sep 26, 2026
已集成到
rewrite/grok-dsh-20260920:022a417(图片生成与编辑服务,基于 33c1699,无需 rebase)。实现(对照验收标准)
[models] image_gen(可选image_edit)指向带base_url且标记supports_image_generation/supports_image_edit的[model.<id>];protocol = "xai"(默认,参考实现 JSON 请求体:prompt、aspect_ratio、resolution、data URL 参考图、b64_json)或"openai"(OpenAI Images:size来自image_size,编辑为 multipartimage[],可直接对接本地 stable-diffusion.cppsd-server)。未配置时两个工具都不注册、不发任何请求;聊天模型不会被当作图片服务,单模型默认也不会选中图片服务。模型的image_gen/image_edit由 dsh 执行(rust-acp-image.mjs,仅在客户端开启时注册),/imagine <描述>逐字发送参考指令;codsh --rust image generate|edit|list(--json)会话外使用同一配置。Allow Generate image "<提示词>" via <主机>?(编辑为Edit image (N ref) …),并注明发送内容、codsh 不知道该服务价格、费用由该服务决定。参考图支持[Image #N]标签(Ctrl+V 粘贴)、绝对路径、file://、data:,Read deny 规则会拒绝参考图路径。运行中行显示已用时间;Ctrl+C 结束请求进程组。官方主机(api.x.ai、grok.com)作为配置错误拒绝,inspect显示imagine (refused; see Invalid configuration)与原因。<会话>/images/<n>.<ext>(目录 0700,不覆盖);服务拒绝、只返回 URL、字节损坏、HTTP 错误(如 402)、超时、取消都不保存文件并显示原因。/images列出、/images open [N]打开(CODSH_IMAGE_OPENER,否则open/xdg-open)。--resume后工具行保留标题(修复了会话投影丢失插件工具 tool/call 导致显示[tool tool]的问题),/imagine按输入原样显示,/images仍列出并打开同一批文件。rust/upstream/MODIFICATIONS(对照 grok-build a28ee2b image_gen/image_edit/storage/imagine 编写,/imagine指令与用法逐字,工具描述去品牌化)。检查(本机 Linux x86_64,keyless mock 模型,隔离临时 HOME,真实 dsh
@deepseek-ai/dsh@0.1.5-rc.2)python3 scripts/rust-image-gen-pty-test.py(新增,已加入test:rust:pty,packed 安装产物 + 回环 xAI 形态假服务):通过。覆盖卡片 n 拒绝 / y 允许并保存images/1.png(96x54)、/imagine逐字、Ctrl+V[Image #1]编辑保存3.png、REFUSE/MALFORMED/URLONLY/HTTP 402 四种失败不落盘、挂起请求 Ctrl+C[cancelled]无文件、/images与 open、resume(标题//imagine/文件)、关闭时RUST_ACP_IMAGE_TOOLS (none)与/imagine needs image_gen、官方主机被拒。scripts/rust-image-gen.spec.mjs22/22;pnpm test106 文件 / 2620 passed / 15 skipped;pnpm run typecheck通过。cargo test --locked --workspace:codsh-rust 741 passed / 4 失败(2 个 filesystem_sandbox、privacy、voice,Linux 基线 33c1699 同样 729/4),其他 crate 1043 passed;新增 12 个 image_gen/config 单测。cargo fmt --check干净;严格 Clippy-D warnings仅基线已有的filesystem_sandbox.rs:743(tail_marker)与:1372(needless_return)2 项,-A dead_code -A clippy::needless_return下 0 警告。pnpm run build、pnpm run build:rust成功(native linux-x64 SHA-256ce4f97ed9fd0e5ee10568038b4a3fca4ede0d2936d0d723ac49fc3a92adc5d7d);check:rust-package(linux-x64)与rust-install-test.py通过。rust-pty-test.py、rust-turn/file/cancel-pty-test.py在 Linux 上按设计拒绝(需 macOS 证据);伪造平台门后 turn/file/cancel 通过,仅作补充。真实服务链(本机 localhost,无密钥,无费用)
stable-diffusion.cpp
sd-server(commit 2f88688,SD-Turbo q8_0,--steps 1 --cfg-scale 1.0),protocol = "openai"、image_size = 256:image generate:256x256 PNG,7.5 s;image edit(1 张参考图):256x256 PNG,12.2 s。/imagine a lighthouse at dusk, watercolor→ 卡片Allow Generate image "a lighthouse at dusk, watercolor" via 127.0.0.1:18187? y=allow once n=reject/Sends the prompt to 127.0.0.1:18187. codsh does not know its price; any charge is set by that service. Each image request asks again.→ y →Image saved to images/1.png (256x256),Service: 127.0.0.1:18187 (sd-turbo) in 7.1s.未验证 / 未覆盖
open打开器;Windows 未运行。Linux 下xdg-open真实查看器未打开(测试用记录脚本)。codsh --rust agent stdio)不提供图片工具;视频生成属于 [Grok/dsh 56] 视频生成与媒体任务状态 #188。未改动
main、npm 发布、默认切换均未改动。