feat: KOC 资源导入后自动爬取主页资料并调用 LLM 打标签

- 新增 structured_text_process 打标客户端(文本构造、标签解析清洗、MCP 调用)
- 写库后后台打标(tagUntaggedAccounts),单条新增 / 批量导入 / 每日补全三个入口统一
- 标签只补空,UPDATE 带 tags 为空守卫,不覆盖已有标签
- 新增 AI_TAGGING_TOOL 配置项(留空关闭),更新配置示例与文档
- 新增 16 个打标测试用例,全量 131 个测试通过
This commit is contained in:
ABAPPLO
2026-08-26 15:21:28 +08:00
parent 9697b5890d
commit 4a64feee02
13 changed files with 557 additions and 11 deletions

View File

@@ -1,9 +1,11 @@
import { isManagerRequest, managerForbidden } from "../../../lib/user-auth";
import { runInBackground } from "../../../lib/background";
import { buildManualRow, type ManualResourceInput } from "../../../lib/resource-import";
import {
analyzeRows,
enrichRows,
loadAccounts,
tagUntaggedAccounts,
writeAnalyzedRows,
} from "../../../lib/resource-write";
@@ -48,6 +50,10 @@ export async function POST(request: Request) {
);
}
await writeAnalyzedRows(analyzed);
runInBackground(
tagUntaggedAccounts(analyzed),
"resource account tagging",
);
const result = analyzed[0];
const outcome: InsertResult = {
action: result.action === "update" ? "update" : "create",