{"record":{"id":"be56d425d9a60112","repo":"flipped-aurora/gin-vue-admin","slug":"aipath-config-yaml","errorCode":null,"errorMessage":"请先前往插件市场个人中心获取 AiPath 并填写到 config.yaml 中","messagePattern":"请先前往插件市场个人中心获取 AiPath 并填写到 config\\.yaml 中","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/service/system/auto_code_llm.go","lineNumber":93,"sourceCode":"\t\thttp.MethodPost,\n\t\tmap[string]string{\n\t\t\t\"Accept\":          \"text/event-stream\",\n\t\t\t\"Accept-Encoding\": \"identity\", // 禁止 gzip，避免 SSE 流被压缩导致缓冲卡住\n\t\t\t\"Cache-Control\":   \"no-cache\",\n\t\t},\n\t\tnil,\n\t\tpayload,\n\t\t-1, // 不设置 client.Timeout，SSE 流的生命周期由 ctx 控制\n\t)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"调用上游大模型流式服务失败: %w\", err)\n\t}\n\treturn res, nil\n}\n\nfunc buildLLMAutoPath(llm common.JSONMap) (string, error) {\n\tif global.GVA_CONFIG.AutoCode.AiPath == \"\" {\n\t\treturn \"\", errors.New(\"请先前往插件市场个人中心获取 AiPath 并填写到 config.yaml 中\")\n\t}\n\n\tmode := strings.TrimSpace(fmt.Sprintf(\"%v\", llm[\"mode\"]))\n\tif mode == \"\" {\n\t\treturn \"\", errors.New(\"llmAuto 缺少 mode 参数\")\n\t}\n\n\treturn strings.ReplaceAll(global.GVA_CONFIG.AutoCode.AiPath, \"{FUNC}\", mode), nil\n}\n\nfunc cloneLLMAutoJSONMap(src common.JSONMap) common.JSONMap {\n\tdst := make(common.JSONMap, len(src))\n\tfor key, value := range src {\n\t\tdst[key] = value\n\t}\n\treturn dst\n}\n","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/flipped-aurora/gin-vue-admin/blob/3136500ef380842b0eb6c4daa87c3f8a47fcf9e0/server/service/system/auto_code_llm.go#L75-L111","documentation":"buildLLMAutoPath() builds the endpoint path used by LLMAuto/LLMAutoStream from config AutoCode.AiPath, substituting {FUNC} with the requested mode. If AiPath is empty in config.yaml, it returns '请先前往插件市场个人中心获取 AiPath 并填写到 config.yaml 中', instructing the user to configure the AI path obtained from the plugin marketplace personal center.","triggerScenarios":"Calling LLMAuto or LLMAutoStream (auto-code AI generation endpoints) while system.auto-code.ai-path (the AutoCode.AiPath config key) is unset or empty in config.yaml.","commonSituations":"Fresh gin-vue-admin deployment where config.yaml was never customized; user has a marketplace account but never copied the AiPath into config; config was overwritten during an upgrade; typo in the config key so the value doesn't bind to the struct.","solutions":["Log into the plugin marketplace personal center and copy your personal AiPath.","Paste it into config.yaml under the auto-code section (AutoCode.AiPath) and restart the server.","Verify the YAML key matches the config struct tag so it actually binds to GVA_CONFIG.AutoCode.AiPath.","After upgrading, re-apply the AiPath if config.yaml was regenerated."],"exampleFix":"# before: config.yaml missing the AI path\nauto-code:\n  ai-path: \"\"\n# after\nauto-code:\n  ai-path: \"https://plugin.gin-vue-admin.com/api/aiAuto/{FUNC}?token=xxxx\"","handlingStrategy":"validation","validationCode":"// check before invoking LLMAuto endpoints\nconst cfg = readGvaConfig()\nif (!cfg['auto-code'] || !cfg['auto-code']['ai-path']) {\n  throw new Error('set auto-code.ai-path in config.yaml (get it from plugin marketplace personal center)')\n}","typeGuard":null,"tryCatchPattern":"try {\n  path, err := buildLLMAutoPath(llm)\n  _ = path\n} catch (err) {\n  if (strings.Contains(err.Error(), \"AiPath\")) {\n    // prompt admin to configure GVA_CONFIG.AutoCode.AiPath\n  } else {\n    panic(err)\n  }\n}","preventionTips":["Set AutoCode.AiPath in config.yaml right after deployment","Re-apply config customizations after upgrades that regenerate config.yaml","Validate required config keys at startup with a fail-fast check","Document where to obtain the AiPath for your team"],"tags":["config","autocode","llm","missing-env-var"],"backgroundTag":"missing-config-value","analyzedSha":"3136500ef380842b0eb6c4daa87c3f8a47fcf9e0","analyzedAt":"2026-08-31T13:50:02.721Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}