与门户页 /zh/cancellation-pricing 相同业务能力:主体名称 / 统一社会信用代码 / 营业执照 → 可核验注销报价。 本页面向合作方后端接入 Dify 官方 Workflow Service API。
http://43.139.35.140/v1
4062f4d9-ef1a-4e09-ac65-0726b873baa9
| 项 | 值 |
|---|---|
| 能力 | 企业注销 / 异常修复类核价(主体核验 → 事实 → 商品匹配 → 客户可见报价) |
| 协议 | Dify Workflow 官方 Service API(无会话) |
| 应用名 | Aijia Service Quote Parent Orchestrator (main-ssot) |
| 应用模式 | workflow |
| Studio 地址 | http://43.139.35.140/app/4062f4d9-ef1a-4e09-ac65-0726b873baa9/workflow |
| 主接口 | POST /v1/workflows/run |
| 鉴权 | Authorization: Bearer <App API Key> |
| 推荐模式 | blocking(对接简单)或 streaming(需要进度) |
Key 与 Workflow 应用绑定,无需在 body 中传 workflow_id 或 app id。
Authorization: Bearer app-xxxxxxxx Content-Type: application/json
| 规则 | 说明 |
|---|---|
| Key 绑定 | 专用 App Key 绑定本 Parent Workflow;创建后即可调用 |
| 保管 | 仅允许合作方服务端持有;禁止写入 App / 小程序 / 浏览器 / 公开文档 |
| 泄露 | 立即通知爱嘉轮换;旧 Key 作废后旧调用全部失败 |
user | 调用方标识,用于日志区分;不是第二把密码 |
建议 user 格式:
partner-<合作方简称>:<业务单号或内部用户ID> # 例:partner-acme:order-20260805-001
连通性自检:
curl -sS -H "Authorization: Bearer $API_KEY" \ "http://43.139.35.140/v1/info" curl -sS -H "Authorization: Bearer $API_KEY" \ "http://43.139.35.140/v1/parameters"
期望:name 为 Parent main-ssot,mode 为 workflow;parameters 含 subject_locator / query_text 等。
POST http://43.139.35.140/v1/workflows/run
Authorization: Bearer {API_KEY}
Content-Type: application/json
{
"inputs": {
"subject_locator": "郯城县帅众花卉园艺场",
"query_text": "郯城县帅众花卉园艺场",
"quote_fact_package_json": "",
"intent": "cancellation_quote",
"effect_mode": "no_send"
},
"response_mode": "blocking",
"user": "partner-acme:order-20260805-001"
}
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
inputs.subject_locator | string | 条件 | 公司名、信用代码,或多主体(一行一个)。最长约 4096 |
inputs.query_text | string | 条件 | 客户原文;通常与 subject_locator 相同 |
inputs.quote_fact_package_json | string | 否 | 结构化事实 JSON;一般传 "" |
inputs.output_profile_json | string | 否 | 输出样式;合作方默认不传 |
inputs.intent | string | 否 | cancellation_quote 或 abnormal_repair |
inputs.effect_mode | string | 否 | 固定 no_send:只核价、不触发企微外发 |
inputs.images | array | 否 | 已上传图片描述符(见图片章节) |
response_mode | string | 是 | blocking 或 streaming |
user | string | 是 | 合作方侧稳定调用标识 |
条件必填:subject_locator / query_text 至少一个非空,或提供有效 images。
{
"inputs": {
"subject_locator": "甲乙百货商行\n丙丁百货商行",
"query_text": "甲乙百货商行\n丙丁百货商行",
"intent": "cancellation_quote",
"effect_mode": "no_send"
},
"response_mode": "blocking",
"user": "partner-acme:batch-001"
}
blocking 成功时 HTTP 200,结构示意:
{
"workflow_run_id": "……",
"task_id": "……",
"data": {
"id": "……",
"status": "succeeded",
"outputs": {
"customer_visible_text": "……客户可见报价全文……",
"customer_answer": "……",
"send_intent": "send",
"route": "……",
"quote_records_json": "[……]",
"subject_count": "1"
},
"elapsed_time": 3.1,
"total_steps": 10
}
}
| 字段 | 用途 |
|---|---|
data.status | 必须为 succeeded 才可继续解析 |
data.outputs.customer_visible_text | 首选客户可见报价正文 |
data.outputs.customer_answer | 兼容字段;前者为空时可用 |
data.outputs.send_intent | 是否可直接给终端客户 |
data.outputs.subject_count | 识别主体数 |
data.outputs.quote_records_json | 结构化明细(可选落库) |
workflow_run_id | 排障引用,请记入合作方日志 |
status === "succeeded" 时采用结果;customer_visible_text;send_intent 为可发送语义(如 send)且文本非空时,才可作为最终报价给终端客户;POST http://43.139.35.140/v1/files/upload
Authorization: Bearer {API_KEY}
Content-Type: multipart/form-data
# 表单:file=图片;user=与后续 workflows/run 保持一致
# 类型:JPEG / PNG / WebP;单次 workflow 最多约 3 张
curl -sS -X POST "http://43.139.35.140/v1/files/upload" \ -H "Authorization: Bearer $API_KEY" \ -F "user=partner-acme:order-img-001" \ -F "[email protected];type=image/jpeg"
响应中的 id 即 upload_file_id。
{
"inputs": {
"subject_locator": "",
"query_text": "",
"intent": "cancellation_quote",
"effect_mode": "no_send",
"images": [
{
"type": "image",
"transfer_method": "local_file",
"upload_file_id": "<上一步返回的 id>"
}
]
},
"response_mode": "blocking",
"user": "partner-acme:order-img-001"
}
POST http://43.139.35.140/v1/workflows/run
Authorization: Bearer {API_KEY}
Content-Type: application/json
Accept: text/event-stream
{ "response_mode": "streaming", ... }
| event | 含义 |
|---|---|
workflow_started | 开始 |
node_started / node_finished | 节点进度(可选 UI) |
workflow_finished | 终态;读取 data.outputs |
error / 失败态 | 按失败处理 |
只在 workflow_finished 且成功时取 outputs,规则同 blocking。
| 情况 | 建议 |
|---|---|
| HTTP 401 | Key 错误或已吊销 → 联系爱嘉 |
| HTTP 400 | 入参非法 → 检查 inputs / user |
| HTTP 413 / 上传失败 | 缩小图片后重试 |
| HTTP 5xx / 超时 | 指数退避;同一业务单号可复用同一 user |
data.status != succeeded | 按失败处理,勿展示半截结果 |
| 业务需人工 | 根据 send_intent / 可见文本提示人工,不自动成交 |
超时建议:纯文本 60~120s;含图 180~300s。
export API_BASE="http://43.139.35.140/v1"
export API_KEY="app-xxxxxxxx" # 仅服务端环境变量
curl -sS -X POST "$API_BASE/workflows/run" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"inputs": {
"subject_locator": "郯城县帅众花卉园艺场",
"query_text": "郯城县帅众花卉园艺场",
"quote_fact_package_json": "",
"intent": "cancellation_quote",
"effect_mode": "no_send"
},
"response_mode": "blocking",
"user": "partner-acme:demo-001"
}'
async function quoteCancellation(companyText, businessId) {
const res = await fetch(`${process.env.API_BASE}/workflows/run`, {
method: 'POST',
headers: {
authorization: `Bearer ${process.env.API_KEY}`,
'content-type': 'application/json',
},
body: JSON.stringify({
inputs: {
subject_locator: companyText,
query_text: companyText,
quote_fact_package_json: '',
intent: 'cancellation_quote',
effect_mode: 'no_send',
},
response_mode: 'blocking',
user: `partner-acme:${businessId}`,
}),
});
if (!res.ok) throw new Error(`HTTP ${res.status}: ${await res.text()}`);
const body = await res.json();
if (body?.data?.status !== 'succeeded') {
throw new Error(`workflow status=${body?.data?.status}`);
}
const out = body.data.outputs || {};
const text = out.customer_visible_text || out.customer_answer || '';
return {
text,
sendIntent: out.send_intent,
subjectCount: out.subject_count,
workflowRunId: body.workflow_run_id,
canShowToCustomer: out.send_intent === 'send' && Boolean(text),
};
}
GET /info 返回 main-ssot Parent 名与 workflowcustomer_visible_textsend_intent !== send 时未错误展示为最终报价| 项 | 约定 |
|---|---|
| 契约版本 | cancellation-quote.partner-dify.v1 |
| 不兼容变更 | 爱嘉提前通知;尽量保持 inputs / 主输出字段稳定 |
| 排障请提供 | user、workflow_run_id、大致时间、主体原文(可脱敏) |
| Key 轮换 | 爱嘉签发新 Key → 合作方切换 → 旧 Key 作废 |