Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
30dfd85113 | ||
|
|
69a1ee0bdf | ||
|
|
3df3847b88 |
@@ -24,8 +24,12 @@ services:
|
|||||||
# 微信接入
|
# 微信接入
|
||||||
- WXBOT_URL=http://agent-wxbot:8093
|
- WXBOT_URL=http://agent-wxbot:8093
|
||||||
- WXBOT_TOKEN=${WXBOT_TOKEN:?WXBOT_TOKEN not set - run scripts/init.sh}
|
- WXBOT_TOKEN=${WXBOT_TOKEN:?WXBOT_TOKEN not set - run scripts/init.sh}
|
||||||
|
- VIRTUAL_HOST=agent.ai.foresh.com
|
||||||
|
- VIRTUAL_PORT=8090
|
||||||
|
- CERT_NAME=default
|
||||||
networks:
|
networks:
|
||||||
- agent-mcp-net
|
- agent-mcp-net
|
||||||
|
- my-app-network
|
||||||
|
|
||||||
# 技能准备(一次性,跑完退出):把各技能的“运行期可变”依赖落到宿主 ./skills——
|
# 技能准备(一次性,跑完退出):把各技能的“运行期可变”依赖落到宿主 ./skills——
|
||||||
# requirements.txt → 先离线探测,只把镜像缺的包装进共享 deps 目录(镜像已带的不重复装);
|
# requirements.txt → 先离线探测,只把镜像缺的包装进共享 deps 目录(镜像已带的不重复装);
|
||||||
@@ -215,3 +219,5 @@ networks:
|
|||||||
agent-mcp-net:
|
agent-mcp-net:
|
||||||
name: agent-mcp-net
|
name: agent-mcp-net
|
||||||
driver: bridge
|
driver: bridge
|
||||||
|
my-app-network:
|
||||||
|
external: true
|
||||||
|
|||||||
@@ -110,13 +110,12 @@ docker exec mcp_image_task node -e "fetch('http://localhost:3000/health').then(r
|
|||||||
`op=get` 按任务状态返回:
|
`op=get` 按任务状态返回:
|
||||||
|
|
||||||
- `PROCESSING`:提示几秒后再查;
|
- `PROCESSING`:提示几秒后再查;
|
||||||
- `SUCCESS`:若干 `text` 块,第一块是摘要,后续每块各包含一张图片的 URL(方便 LLM 直接贴图或下载):
|
- `SUCCESS`:单个 `text` 块,摘要后跟图片 URL(单图直接给 `Image URL:`,多图按 `Image N:` 逐行列出):
|
||||||
|
|
||||||
```jsonc
|
```jsonc
|
||||||
{
|
{
|
||||||
"content": [
|
"content": [
|
||||||
{ "type": "text", "text": "task_id: <uuid>\nmodel: CogView-3-Flash\ntask_status: SUCCESS\nImage 1: https://maas-watermark-prod-new.cn-wlcb.ufileos.com/..." },
|
{ "type": "text", "text": "task_id: <uuid>\nmodel: CogView-3-Flash\ntask_status: SUCCESS\nImage URL: https://maas-watermark-prod-new.cn-wlcb.ufileos.com/..." }
|
||||||
{ "type": "text", "text": "https://maas-watermark-prod-new.cn-wlcb.ufileos.com/..." }
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -185,7 +185,10 @@ function runImageTask({ task, token, model, prompt }) {
|
|||||||
|
|
||||||
// ===== op=create:提交图片生成(立即返回 task_id,后台执行)=====
|
// ===== op=create:提交图片生成(立即返回 task_id,后台执行)=====
|
||||||
async function handleCreate({ args, headers, token }) {
|
async function handleCreate({ args, headers, token }) {
|
||||||
if (!args.prompt) {
|
// schema 只约束了 min(1)," " 这种纯空白能通过校验并白跑一次出图,所以这里 trim 后再判。
|
||||||
|
// 顺手用 trim 过的值:上游拿到的 prompt 不带首尾空白。
|
||||||
|
const prompt = typeof args.prompt === "string" ? args.prompt.trim() : "";
|
||||||
|
if (!prompt) {
|
||||||
return {
|
return {
|
||||||
isError: true,
|
isError: true,
|
||||||
content: [{ type: "text", text: 'op=create requires "prompt".' }],
|
content: [{ type: "text", text: 'op=create requires "prompt".' }],
|
||||||
@@ -202,13 +205,13 @@ async function handleCreate({ args, headers, token }) {
|
|||||||
const task = {
|
const task = {
|
||||||
status: "PROCESSING",
|
status: "PROCESSING",
|
||||||
model,
|
model,
|
||||||
prompt: args.prompt,
|
prompt,
|
||||||
createdAt: Date.now(),
|
createdAt: Date.now(),
|
||||||
};
|
};
|
||||||
tasks.set(taskId, task);
|
tasks.set(taskId, task);
|
||||||
|
|
||||||
// token/model 在此刻从本次请求 header 捕获进闭包,后台完成前无需再取
|
// token/model 在此刻从本次请求 header 捕获进闭包,后台完成前无需再取
|
||||||
runImageTask({ task, token, model, prompt: args.prompt });
|
runImageTask({ task, token, model, prompt });
|
||||||
|
|
||||||
const summary =
|
const summary =
|
||||||
`Model: ${model}\n` +
|
`Model: ${model}\n` +
|
||||||
@@ -223,14 +226,16 @@ async function handleCreate({ args, headers, token }) {
|
|||||||
|
|
||||||
// ===== op=get:查询任务状态(只读本地表,不碰上游)=====
|
// ===== op=get:查询任务状态(只读本地表,不碰上游)=====
|
||||||
async function handleGet({ args }) {
|
async function handleGet({ args }) {
|
||||||
if (!args.task_id) {
|
// 与 handleCreate 同理:纯空白 task_id 应报"缺参数",而不是得到 Unknown task_id " " 这种含糊错误。
|
||||||
|
const taskId = typeof args.task_id === "string" ? args.task_id.trim() : "";
|
||||||
|
if (!taskId) {
|
||||||
return {
|
return {
|
||||||
isError: true,
|
isError: true,
|
||||||
content: [{ type: "text", text: 'op=get requires "task_id".' }],
|
content: [{ type: "text", text: 'op=get requires "task_id".' }],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const task = tasks.get(args.task_id);
|
const task = tasks.get(taskId);
|
||||||
if (!task) {
|
if (!task) {
|
||||||
return {
|
return {
|
||||||
isError: true,
|
isError: true,
|
||||||
@@ -238,7 +243,7 @@ async function handleGet({ args }) {
|
|||||||
{
|
{
|
||||||
type: "text",
|
type: "text",
|
||||||
text:
|
text:
|
||||||
`Unknown task_id "${args.task_id}". ` +
|
`Unknown task_id "${taskId}". ` +
|
||||||
`Finished tasks are kept for 1 hour and are lost on service restart.`,
|
`Finished tasks are kept for 1 hour and are lost on service restart.`,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -251,7 +256,7 @@ async function handleGet({ args }) {
|
|||||||
{
|
{
|
||||||
type: "text",
|
type: "text",
|
||||||
text:
|
text:
|
||||||
`task_id: ${args.task_id}\n` +
|
`task_id: ${taskId}\n` +
|
||||||
`model: ${task.model}\n` +
|
`model: ${task.model}\n` +
|
||||||
`task_status: PROCESSING\n` +
|
`task_status: PROCESSING\n` +
|
||||||
`\n` +
|
`\n` +
|
||||||
@@ -267,25 +272,24 @@ async function handleGet({ args }) {
|
|||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
type: "text",
|
type: "text",
|
||||||
text: `task_id: ${args.task_id}\ntask_status: FAIL\nerror: ${task.error}`,
|
text: `task_id: ${taskId}\ntask_status: FAIL\nerror: ${task.error}`,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// SUCCESS:输出格式与原同步版 create 一致(摘要块 + 每张图一个 URL 块)
|
// SUCCESS:单块输出。旧格式是「摘要块 + 每张图一个裸 URL 块」,但 core 的 mcp.callTool
|
||||||
const lines = task.urls.map((u, i) => `Image ${i + 1}: ${u}`).join("\n");
|
// 只把 text 块用 \n 拼起来(串前端/微信也不认裸 URL 块),结果就是同一 URL 在模型面前出现两遍。
|
||||||
|
const lines =
|
||||||
|
task.urls.length === 1
|
||||||
|
? `Image URL: ${task.urls[0]}`
|
||||||
|
: task.urls.map((u, i) => `Image ${i + 1}: ${u}`).join("\n");
|
||||||
const summary =
|
const summary =
|
||||||
`task_id: ${args.task_id}\n` +
|
`task_id: ${taskId}\n` +
|
||||||
`model: ${task.model}\n` +
|
`model: ${task.model}\n` +
|
||||||
`task_status: SUCCESS\n` +
|
`task_status: SUCCESS\n` +
|
||||||
`${lines}`;
|
`${lines}`;
|
||||||
return {
|
return { content: [{ type: "text", text: summary }] };
|
||||||
content: [
|
|
||||||
{ type: "text", text: summary },
|
|
||||||
...task.urls.map((u) => ({ type: "text", text: u })),
|
|
||||||
],
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildServer() {
|
function buildServer() {
|
||||||
@@ -303,28 +307,33 @@ function buildServer() {
|
|||||||
|
|
||||||
server.tool(
|
server.tool(
|
||||||
"image_task",
|
"image_task",
|
||||||
`AI image generation.
|
`AI image generation task.
|
||||||
|
|
||||||
op=create Submit a new task. Returns a task_id immediately; generation runs in background.
|
Operations:
|
||||||
Requires prompt.
|
- \`create\`: Create a new generation task. Requires \`prompt\`. Returns \`task_id\` immediately; generation runs in background.
|
||||||
op=get Fetch the status of a previously submitted task. Requires task_id.
|
- \`get\`: Check an existing task. Requires \`task_id\`. Returns status and, on SUCCESS, image URLs.
|
||||||
On SUCCESS, returns the image URLs.
|
|
||||||
|
|
||||||
Typical flow: call op=create, then call op=get with the returned task_id until task_status is SUCCESS or FAIL.`,
|
Examples:
|
||||||
|
- New image request → \`{"op":"create","prompt":"A cat sitting in a garden"}\`
|
||||||
|
- Check task result → \`{"op":"get","task_id":"<task_id from create>"}\`
|
||||||
|
|
||||||
|
Workflow: call \`create\` once, then call \`get\` with the returned \`task_id\` until \`task_status\` is \`SUCCESS\` or \`FAIL\`. Never call \`get\` without a \`task_id\`, and never submit duplicate tasks just to check status.`,
|
||||||
{
|
{
|
||||||
op: z.enum(["create", "get"]).describe("Operation to perform."),
|
op: z
|
||||||
|
.enum(["create", "get"])
|
||||||
|
.describe("Use create to start a new image generation task; use get to check a task by its task_id."),
|
||||||
prompt: z
|
prompt: z
|
||||||
.string()
|
.string()
|
||||||
.min(1)
|
.min(1)
|
||||||
.optional()
|
.optional()
|
||||||
.describe(
|
.describe(
|
||||||
"Image generation prompt; describe the desired scene in detail. Required when op=create."
|
"Image generation prompt; describe the desired scene in detail. Required for create; omit for get."
|
||||||
),
|
),
|
||||||
task_id: z
|
task_id: z
|
||||||
.string()
|
.string()
|
||||||
.min(1)
|
.min(1)
|
||||||
.optional()
|
.optional()
|
||||||
.describe("task_id returned by op=create. Required when op=get."),
|
.describe("task_id returned by create. Required for get; omit for create."),
|
||||||
},
|
},
|
||||||
async (args, extra) => {
|
async (args, extra) => {
|
||||||
// SDK 在 tool callback 的 extra.requestInfo.headers 里会透传当前 HTTP 请求的 headers
|
// SDK 在 tool callback 的 extra.requestInfo.headers 里会透传当前 HTTP 请求的 headers
|
||||||
|
|||||||
@@ -105,12 +105,11 @@ docker exec mcp_video_task node -e "fetch('http://localhost:3000/health').then(r
|
|||||||
|
|
||||||
### 返回(op=get)
|
### 返回(op=get)
|
||||||
|
|
||||||
- **`SUCCESS`**:返回 `Video URL`(智谱签名 URL,**24h 左右有效**,需及时转存),外加一张 `Cover` 封面图:
|
- **`SUCCESS`**:单个 `text` 块,含 `Video URL`(智谱签名 URL,**24h 左右有效**,需及时转存),以及 `Cover` 封面图:
|
||||||
```jsonc
|
```jsonc
|
||||||
{
|
{
|
||||||
"content": [
|
"content": [
|
||||||
{ "type": "text", "text": "task_id: ...\nmodel: cogvideox-flash\ntask_status: SUCCESS\nVideo URL: https://...\nCover: https://..." },
|
{ "type": "text", "text": "task_id: ...\nmodel: cogvideox-flash\ntask_status: SUCCESS\nVideo URL: https://...\nCover: https://..." }
|
||||||
{ "type": "text", "text": "https://...video url..." }
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -193,7 +193,11 @@ async function queryAsyncResult({ token, id }) {
|
|||||||
|
|
||||||
// ---------- op=create 的业务处理 ----------
|
// ---------- op=create 的业务处理 ----------
|
||||||
async function handleCreate({ args, headers, token }) {
|
async function handleCreate({ args, headers, token }) {
|
||||||
if (!args.prompt && !args.image_url) {
|
// 纯空白 prompt 等同没给:schema 只校验类型/长度,不校验内容。
|
||||||
|
// 不 trim 的话,“ ”会被当成合法 prompt 提交(text-to-video 拿到空白提示词,
|
||||||
|
// image-to-video 则多传一个无意义字段)。
|
||||||
|
const prompt = typeof args.prompt === "string" ? args.prompt.trim() : "";
|
||||||
|
if (!prompt && !args.image_url) {
|
||||||
return {
|
return {
|
||||||
isError: true,
|
isError: true,
|
||||||
content: [
|
content: [
|
||||||
@@ -223,7 +227,7 @@ async function handleCreate({ args, headers, token }) {
|
|||||||
const data = await submitVideo({
|
const data = await submitVideo({
|
||||||
token,
|
token,
|
||||||
model,
|
model,
|
||||||
prompt: args.prompt,
|
prompt,
|
||||||
image_url: args.image_url,
|
image_url: args.image_url,
|
||||||
quality,
|
quality,
|
||||||
with_audio: args.with_audio ?? false,
|
with_audio: args.with_audio ?? false,
|
||||||
@@ -258,7 +262,10 @@ async function handleCreate({ args, headers, token }) {
|
|||||||
|
|
||||||
// ---------- op=get 的业务处理 ----------
|
// ---------- op=get 的业务处理 ----------
|
||||||
async function handleGet({ args, token }) {
|
async function handleGet({ args, token }) {
|
||||||
if (!args.task_id) {
|
// 与 handleCreate 同理:纯空白 task_id 不能直接拼进上游路径,
|
||||||
|
// 否则会得到一条含编码后空白的上游报错,既无从归因也误导模型。
|
||||||
|
const taskId = typeof args.task_id === "string" ? args.task_id.trim() : "";
|
||||||
|
if (!taskId) {
|
||||||
return {
|
return {
|
||||||
isError: true,
|
isError: true,
|
||||||
content: [{ type: "text", text: 'op=get requires "task_id".' }],
|
content: [{ type: "text", text: 'op=get requires "task_id".' }],
|
||||||
@@ -266,7 +273,7 @@ async function handleGet({ args, token }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const data = await queryAsyncResult({ token, id: args.task_id });
|
const data = await queryAsyncResult({ token, id: taskId });
|
||||||
const status = data.task_status || "UNKNOWN";
|
const status = data.task_status || "UNKNOWN";
|
||||||
|
|
||||||
if (status === "SUCCESS") {
|
if (status === "SUCCESS") {
|
||||||
@@ -290,12 +297,9 @@ async function handleGet({ args, token }) {
|
|||||||
`task_status: SUCCESS\n` +
|
`task_status: SUCCESS\n` +
|
||||||
`Video URL: ${v.url}\n` +
|
`Video URL: ${v.url}\n` +
|
||||||
(v.cover_image_url ? `Cover: ${v.cover_image_url}\n` : "");
|
(v.cover_image_url ? `Cover: ${v.cover_image_url}\n` : "");
|
||||||
return {
|
// 单块输出:URL 已经写在摘要里,旧版额外回一个裸 URL 块会让模型
|
||||||
content: [
|
// (core 会把 text 块 join 成一段)看到同一个链接两遍。
|
||||||
{ type: "text", text: summary },
|
return { content: [{ type: "text", text: summary }] };
|
||||||
{ type: "text", text: v.url },
|
|
||||||
],
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// PROCESSING / FAIL / 其他:原样返回关键字段
|
// PROCESSING / FAIL / 其他:原样返回关键字段
|
||||||
@@ -336,43 +340,49 @@ function buildServer() {
|
|||||||
|
|
||||||
server.tool(
|
server.tool(
|
||||||
"video_task",
|
"video_task",
|
||||||
`AI video generation.
|
`AI video generation task.
|
||||||
|
|
||||||
op=create Submit a new task. Returns a task_id immediately; generation runs asynchronously.
|
Operations:
|
||||||
Requires at least one of prompt or image_url.
|
- \`create\`: Start a new video generation task. Requires at least one of \`prompt\` or \`image_url\`. Returns \`task_id\` immediately; generation runs in background.
|
||||||
- text-to-video: pass prompt only.
|
- \`get\`: Check an existing task. Requires \`task_id\`. Returns status and, on SUCCESS, the video URL.
|
||||||
- image-to-video: also pass image_url.
|
|
||||||
op=get Fetch the status of a previously submitted task. Requires task_id.
|
|
||||||
On SUCCESS, returns the video URL.
|
|
||||||
|
|
||||||
Typical flow: call op=create, then call op=get with the returned task_id until task_status is SUCCESS or FAIL.`,
|
Examples:
|
||||||
|
- Text-to-video → \`{"op":"create","prompt":"A cat running in a garden"}\`
|
||||||
|
- Image-to-video → \`{"op":"create","image_url":"https://example.com/cat.jpg","prompt":"The cat runs forward"}\`
|
||||||
|
- Check task → \`{"op":"get","task_id":"<task_id from create>"}\`
|
||||||
|
|
||||||
|
Workflow: call \`create\` once, then call \`get\` with the returned \`task_id\` until \`task_status\` is \`SUCCESS\` or \`FAIL\`. Never create duplicate tasks just to check status.`,
|
||||||
{
|
{
|
||||||
op: z.enum(["create", "get"]).describe("Operation to perform."),
|
op: z
|
||||||
|
.enum(["create", "get"])
|
||||||
|
.describe(
|
||||||
|
"Use create to start video generation; use get to check a task by its task_id."
|
||||||
|
),
|
||||||
prompt: z
|
prompt: z
|
||||||
.string()
|
.string()
|
||||||
.max(512)
|
.max(512)
|
||||||
.optional()
|
.optional()
|
||||||
.describe(
|
.describe(
|
||||||
"Video text description (max 512 chars). Used with op=create. When combined with image_url it serves as the motion/action description."
|
"Video description, max 512 characters. Required for text-to-video; when combined with image_url it describes the motion."
|
||||||
),
|
),
|
||||||
image_url: z
|
image_url: z
|
||||||
.string()
|
.string()
|
||||||
.url()
|
.url()
|
||||||
.optional()
|
.optional()
|
||||||
.describe(
|
.describe(
|
||||||
"Reference image for image-to-video. Used with op=create. Must be a publicly reachable URL to a png/jpeg/jpg <= 5MB (for local files, first use the agent's built-in tool to mint a public temporary URL)."
|
"Reference image for image-to-video: publicly reachable png/jpeg/jpg URL <= 5 MB. For local files, first use the built-in mint_public_link tool to get a public temporary URL."
|
||||||
),
|
),
|
||||||
with_audio: z
|
with_audio: z
|
||||||
.boolean()
|
.boolean()
|
||||||
.optional()
|
.optional()
|
||||||
.describe(
|
.describe(
|
||||||
"Whether to generate AI audio. Used with op=create. Default false."
|
"Whether to generate AI audio. Used with create; defaults to false."
|
||||||
),
|
),
|
||||||
task_id: z
|
task_id: z
|
||||||
.string()
|
.string()
|
||||||
.min(1)
|
.min(1)
|
||||||
.optional()
|
.optional()
|
||||||
.describe("task_id returned by op=create. Required when op=get."),
|
.describe("task_id returned by create. Required for get; omit for create."),
|
||||||
},
|
},
|
||||||
async (args, extra) => {
|
async (args, extra) => {
|
||||||
const headers = extra?.requestInfo?.headers;
|
const headers = extra?.requestInfo?.headers;
|
||||||
|
|||||||
+2
-2
@@ -184,7 +184,7 @@ apt-get install -y -qq some-package
|
|||||||
|
|
||||||
- `install.sh` 必须可执行(`chmod +x install.sh`)。
|
- `install.sh` 必须可执行(`chmod +x install.sh`)。
|
||||||
- 请保持幂等:init 侧以内容 hash 缓存(`.deps_installed`),构建侧靠 Docker 层缓存;脚本应在“依赖已就绪”时快速跳过。
|
- 请保持幂等:init 侧以内容 hash 缓存(`.deps_installed`),构建侧靠 Docker 层缓存;脚本应在“依赖已就绪”时快速跳过。
|
||||||
- 想两处都跑不报错:apt 类语句加 `|| true` 容错,并在脚本末尾自行校验“要的东西是否就绪”,就绪则 exit 0、否则 exit 1(参考 `img-utils/install.sh`)。否则 init 阶段(根文件系统只读)的 apt 失败会让整个技能被标记为“未就绪”。
|
- 想两处都跑不报错:apt 类语句加 `|| true` 容错,并在脚本末尾自行校验“要的东西是否就绪”,就绪则 exit 0、否则 exit 1(参考 `image-process/install.sh`)。否则 init 阶段(根文件系统只读)的 apt 失败会让整个技能被标记为“未就绪”。
|
||||||
- 改动 `install.sh` 后:系统包需 `docker compose build agent-executor`,资产需 `docker compose up -d`(或两者一起 `build && up`)。
|
- 改动 `install.sh` 后:系统包需 `docker compose build agent-executor`,资产需 `docker compose up -d`(或两者一起 `build && up`)。
|
||||||
|
|
||||||
### 5.3 缓存机制
|
### 5.3 缓存机制
|
||||||
@@ -291,7 +291,7 @@ A:目前所有技能共享同一个 `deps` 目录,建议锁定精确版本
|
|||||||
|
|
||||||
查看现有的 `x2pdf` 技能(位于 `skills/x2pdf/`)可以了解一个较为完整的实现,包括如何自带声明 Python 依赖与系统级依赖(不假设镜像预烘)、按扩展名分派渲染后端、参数化版式 CSS 等。但请根据自身技能的实际需求进行设计,不必拘泥于该示例。
|
查看现有的 `x2pdf` 技能(位于 `skills/x2pdf/`)可以了解一个较为完整的实现,包括如何自带声明 Python 依赖与系统级依赖(不假设镜像预烘)、按扩展名分派渲染后端、参数化版式 CSS 等。但请根据自身技能的实际需求进行设计,不必拘泥于该示例。
|
||||||
|
|
||||||
图像处理类需求可参考 `skills/img-utils/`:它演示了一个纯 Python + 预装 Pillow 的实现(转换/缩放/裁剪/压缩/水印/切片/拼图,无 requirements.txt,仅靠 install.sh 保证中文字体),并明确区分“确定性图像处理”与“AI 生成/修图”的能力边界。
|
图像处理类需求可参考 `skills/image-process/`:它演示了一个纯 Python + 预装 Pillow 的实现(转换/缩放/裁剪/压缩/水印/切片/拼图,无 requirements.txt,仅靠 install.sh 保证中文字体),并明确区分“确定性图像处理”与“AI 生成/修图”的能力边界。
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
name: img-utils
|
name: image-process
|
||||||
description: 图像处理(Pillow)。查看图片信息、格式转换、缩放、裁剪、压缩、文字水印、九宫格切片、多图拼图。仅做确定性图像处理,不做 AI 生成/修图
|
description: 图像处理(Pillow)。查看图片信息、格式转换、缩放、裁剪、压缩、文字水印、九宫格切片、多图拼图。仅做确定性图像处理,不做 AI 生成/修图
|
||||||
input_schema:
|
input_schema:
|
||||||
type: object
|
type: object
|
||||||
@@ -87,7 +87,7 @@ output_schema:
|
|||||||
- `grid`:把同一目录下多张图拼成一张 contact sheet(缩略图网格)
|
- `grid`:把同一目录下多张图拼成一张 contact sheet(缩略图网格)
|
||||||
|
|
||||||
## 使用说明
|
## 使用说明
|
||||||
通过 `skill` 的 `{"run":"img-utils","args":{...}}` 调用,参数:
|
通过 `skill` 的 `{"run":"image-process","args":{...}}` 调用,参数:
|
||||||
- `action`:操作类型(必填)
|
- `action`:操作类型(必填)
|
||||||
- `input`:输入图片或目录(必填;相对会话工作目录的路径即可,会自动转绝对路径)
|
- `input`:输入图片或目录(必填;相对会话工作目录的路径即可,会自动转绝对路径)
|
||||||
- `output`:输出路径(建议给全;不给时自动生成 `<原名>_<动作>.<原扩展名>`,绝不覆盖原图)
|
- `output`:输出路径(建议给全;不给时自动生成 `<原名>_<动作>.<原扩展名>`,绝不覆盖原图)
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
img-utils 技能主入口:用 Pillow 做确定性的图像处理(不含 AI 生成/语义修图)。
|
image-process 技能主入口:用 Pillow 做确定性的图像处理(不含 AI 生成/语义修图)。
|
||||||
|
|
||||||
支持动作 action:
|
支持动作 action:
|
||||||
- info 查看图片信息(尺寸/模式/格式/体积)
|
- info 查看图片信息(尺寸/模式/格式/体积)
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
name: office
|
name: office
|
||||||
description: Office 文档(docx/xlsx/pptx)创建、精确编辑、结构检视
|
description: Office 文档(docx/xlsx/pptx)创建、精确编辑、结构检视
|
||||||
|
required: true
|
||||||
---
|
---
|
||||||
|
|
||||||
## 功能
|
## 功能
|
||||||
|
|||||||
Reference in New Issue
Block a user