Commit Graph
6 Commits
Author SHA1 Message Date
ssw 6f96c937c4 BS-新30 v0.15+ workflow AI 修复层 (SSW 同步 form 模式, 2026-07-02)
背景: workflow --ai 走 NCPF /api/workflow/ai, 同样有'超长'风险
  - LLM 输出 BPMN XML, 复杂流程轻松 > 1500 token (jnpf 硬编码)
  - 截断 → 后端 SYS181 → dacli 抛错, 无 fallback
  - form AI 已有 SSW 修复层 (commit 038bd98, BS-新30), workflow 没有

修复 (跟 form 平行):
- AIRepairService 接口:
  - 新加 repairWorkflow(keyword) 方法
  - 新加 getGenFlowQuestion() (注: jnpf 字段名拼写错是 GEN_FLOW_QUETION)
- AIRepairServiceImpl:
  - 反射读 jnpf AiConstants.GEN_FLOW_QUETION
  - LLM 输出 JSON {enCode, fullName, flowXml} → 解析 → WorkFlowAiModel 兼容结构
  - 复用 SswLLMClient (maxTokens=3000) + JsonRepairUtil 修复层
- SswAIRepairController:
  - 新加 POST /api/ssw/ai/repair-workflow 端点
  - 跟 /api/ssw/ai/repair 平行, 同样的 SSW 拦截层

返回: {enCode, fullName, flowXml, sortCode} (jnpf WorkFlowAiModel 兼容)

下一步 (dacli 端):
  - form/_ai.ts 新加 callSswAiWorkflowRepair
  - callAiWorkflow NCPF 失败 → fallback SSW
  - 5s/10s/20s retry

来源: dacli form --ai BS-新30 修复模式 (commit 038bd98)
2026-07-02 12:54:33 +08:00
sswandClaude 038bd981fc ssw-common: BS-新30 v0.14+ AI 修复层 (dacli form create --ai fallback)
背景: jnpf-common-ai/SendAiMessage.java:148 硬编码 maxTokens=1500,
       不对 LLM 输出做 format 修复. LLM 输出经常不规范:
       - fieldOptions: ["男","女"] 字符串数组 (期望 List<{id, fullName}>)
       - 含 // 注释行 (fastjson 1.2.83 不支持, 抛 "not match : -")
       - 输出截断缺闭合 } 或 ]
       - 偶尔输出纯文字说明 (无 JSON)
       - 输出字段名用 SQL 关键字 (name/status) 触发 BS-新3 SYS128

CLAUDE.md §14 规定 jnpf 源码不能改, 所以加 ssw-common 拦截层:

ssw-common-biz 新增:
- util/JsonRepairUtil: stripMarkdownFence + extractJsonArray + stripJsonComments
  + tryCloseTruncatedJson + fixFieldOptionsStrings
- util/SswLLMClient: 从 base_ai 表读 default AI 配置 + 直调 MiniMax OpenAI 兼容 API
  (maxTokens=3000, 可注入)
- service/AIRepairService: 入口接口
- service/impl/AIRepairServiceImpl: 调 LLMClient 拿原始 → JsonRepairUtil 修复
  → 构造 VisualAiModel 兼容结构 + fixFieldKeywords 修复 SQL 关键字
  (name → nameX, status → statusX 等, 镜像 jnpf GenerateConstant.containKeyword)

ssw-common-controller 新增:
- SswAIRepairController: POST /api/ssw/ai/repair 暴露给 dacli fallback

集成: dacli form create --ai 失败时 (后端错/空 data) 自动调 SSW 修复,
       完全不动 jnpf 源码. CLAUDE.md §3.6 兼容 (ssw-common 是合规扩展点).

测试: 26 字段用户管理表 --ai prompt, jnpf 后端返回空 → SSW fallback 修复
       → 26 字段全部生成 + fieldOptions 自动转换 → form 创建+发布成功
       (id=842169175051863237).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
2026-07-02 01:00:09 +08:00
ssw fd75311d25 chore(boot): untrack all target/ build dirs (601 entries) and *.jar (27) 2026-06-11 10:26:31 +08:00
ssw 1af57696f3 chore(boot): gitignore target/ and *.jar; untrack existing build artifacts 2026-06-11 10:25:01 +08:00
ssw 9a602d6f45 chore: pre-autopush snapshot @ 2026-06-11T10:05:43 (working tree snapshot) 2026-06-11 10:09:45 +08:00
admin 03f4d36d92 feat: initial commit 2026-05-18 09:22:20 +08:00