{
  "hnl_v": "1.0",
  "type": "CONFIG_SPEC",
  "id": "FS-DC-SECRETS-001",
  "domain": "fifth-system/darkcore-channel",
  "sovereign": "TCS-0002∞",
  "copyright": "国作登字-2026-A-00037559",
  "created": "2026-04-13T08:00:00Z",
  "created_by": "ZY001",

  "purpose": {
    "cn": "之之仓库(guanghu-zhizhi)的密钥命名规范 + LLM智能路由配置",
    "essence": "统一命名，铸渊好管理，不容易乱，后续协作推送更新都可以自动化"
  },

  "secrets_naming_convention": {
    "_doc": "之之仓库的GitHub Repository Secrets命名规范。所有密钥名称前缀统一为QQ_（秋秋的编号），与铸渊侧的ZY_前缀区分。",

    "prefix_rule": {
      "format": "QQ_{CATEGORY}_{SERVICE}_{FIELD}",
      "example": "QQ_LLM_QWEN_API_KEY",
      "categories": {
        "LLM": "大模型API密钥",
        "COS": "腾讯云COS存储桶密钥",
        "SVR": "服务器连接密钥",
        "DEPLOY": "部署相关密钥",
        "NOTIFY": "通知相关密钥"
      }
    },

    "required_secrets": {
      "服务器连接": {
        "QQ_SVR_SV_HOST": {
          "说明": "硅谷服务器IP地址",
          "来源": "冰朔提供",
          "对应铸渊侧": "ZY_SVR_SV_HOST（相同值）"
        },
        "QQ_SVR_SV_KEY": {
          "说明": "硅谷服务器SSH私钥",
          "来源": "为秋秋专门生成的SSH密钥对（不与铸渊共用）",
          "对应铸渊侧": "独立密钥"
        },
        "QQ_SVR_SV_USER": {
          "说明": "硅谷服务器SSH用户名",
          "值": "qiuqiu",
          "对应铸渊侧": "ZY_SVR_SV_USER=root（铸渊用root，秋秋用独立用户）"
        }
      },

      "COS存储桶": {
        "QQ_COS_SECRET_ID": {
          "说明": "腾讯云COS SecretId",
          "来源": "铸渊侧腾讯云CAM子用户（zy-persona-qiuqiu）的密钥",
          "对应铸渊侧": "ZY_COS_QIUQIU_SECRET_ID"
        },
        "QQ_COS_SECRET_KEY": {
          "说明": "腾讯云COS SecretKey",
          "来源": "铸渊侧腾讯云CAM子用户的密钥",
          "对应铸渊侧": "ZY_COS_QIUQIU_SECRET_KEY"
        },
        "QQ_COS_BUCKET": {
          "说明": "COS桶名称",
          "值": "zy-team-hub-1317346199",
          "注意": "这不是秘密值，但放在secrets里方便workflow引用"
        },
        "QQ_COS_REGION": {
          "说明": "COS桶区域",
          "值": "ap-guangzhou"
        }
      },

      "大模型API（通义千问）": {
        "QQ_LLM_QWEN_API_KEY": {
          "说明": "通义千问官方API密钥",
          "来源": "之之在阿里云开通",
          "用途": "国内首选大模型·对话/代码生成"
        },
        "QQ_LLM_QWEN_BASE_URL": {
          "说明": "通义千问API基础URL",
          "默认值": "https://dashscope.aliyuncs.com/compatible-mode/v1",
          "注意": "可不配置，使用默认值"
        }
      },

      "大模型API（智谱清言）": {
        "QQ_LLM_ZHIPU_API_KEY": {
          "说明": "智谱清言(GLM)官方API密钥",
          "来源": "之之在智谱官网开通",
          "用途": "国内备选大模型·通义不可用时降级"
        }
      },

      "大模型API（第三方聚合）": {
        "QQ_LLM_THIRD_PARTY_API_KEY": {
          "说明": "第三方大模型聚合平台API密钥",
          "来源": "之之自行购买的第三方服务",
          "用途": "多模型聚合·国内外模型都有"
        },
        "QQ_LLM_THIRD_PARTY_BASE_URL": {
          "说明": "第三方平台API基础URL",
          "来源": "第三方平台提供",
          "注意": "必须配置·不同平台URL不同"
        }
      },

      "跨仓库桥接": {
        "QQ_BRIDGE_GITHUB_TOKEN": {
          "说明": "GitHub Personal Access Token（用于接收铸渊的repository_dispatch事件）",
          "来源": "之之在GitHub生成",
          "权限": "repo scope",
          "用途": "铸渊通过GitHub Actions触发秋秋的workflow"
        }
      }
    }
  },

  "llm_router_config": {
    "_doc": "LLM智能路由配置。系统自动检测用什么模型。第三方平台不写死格式，自动探测。",

    "routing_strategy": {
      "说明": "优先级降级路由：先尝试首选→不可用则尝试备选→都不可用则尝试第三方",
      "priority": [
        {
          "rank": 1,
          "provider": "qwen",
          "说明": "通义千问优先",
          "models": ["qwen-turbo", "qwen-plus", "qwen-max"],
          "secret_key": "QQ_LLM_QWEN_API_KEY",
          "base_url_secret": "QQ_LLM_QWEN_BASE_URL",
          "base_url_default": "https://dashscope.aliyuncs.com/compatible-mode/v1"
        },
        {
          "rank": 2,
          "provider": "zhipu",
          "说明": "智谱清言备选",
          "models": ["glm-4-flash", "glm-4", "glm-4-plus"],
          "secret_key": "QQ_LLM_ZHIPU_API_KEY",
          "base_url_default": "https://open.bigmodel.cn/api/paas/v4"
        },
        {
          "rank": 3,
          "provider": "third_party",
          "说明": "第三方聚合平台·多模型·智能选择",
          "models": "auto_detect",
          "secret_key": "QQ_LLM_THIRD_PARTY_API_KEY",
          "base_url_secret": "QQ_LLM_THIRD_PARTY_BASE_URL",
          "model_selection": "auto",
          "注意": "第三方平台通常支持OpenAI兼容协议，系统通过/v1/models接口自动探测可用模型列表"
        }
      ]
    },

    "auto_detection": {
      "说明": "对于第三方平台，启动时自动调用 GET {base_url}/models 获取可用模型列表",
      "cache": "模型列表缓存24小时",
      "fallback": "如果探测失败，使用默认模型名 gpt-3.5-turbo（大多数平台支持）"
    },

    "env_file_template": {
      "说明": "部署到硅谷服务器时写入 /opt/qiuqiu/config/.env.app 的环境变量模板",
      "variables": {
        "QQ_LLM_PRIMARY_PROVIDER": "qwen",
        "QQ_LLM_QWEN_API_KEY": "${secrets.QQ_LLM_QWEN_API_KEY}",
        "QQ_LLM_QWEN_BASE_URL": "${secrets.QQ_LLM_QWEN_BASE_URL:-https://dashscope.aliyuncs.com/compatible-mode/v1}",
        "QQ_LLM_ZHIPU_API_KEY": "${secrets.QQ_LLM_ZHIPU_API_KEY}",
        "QQ_LLM_THIRD_PARTY_API_KEY": "${secrets.QQ_LLM_THIRD_PARTY_API_KEY}",
        "QQ_LLM_THIRD_PARTY_BASE_URL": "${secrets.QQ_LLM_THIRD_PARTY_BASE_URL}",
        "QQ_COS_SECRET_ID": "${secrets.QQ_COS_SECRET_ID}",
        "QQ_COS_SECRET_KEY": "${secrets.QQ_COS_SECRET_KEY}",
        "QQ_COS_BUCKET": "zy-team-hub-1317346199",
        "QQ_COS_REGION": "ap-guangzhou",
        "QQ_APP_PORT": "3900",
        "QQ_NODE_ENV": "production"
      }
    }
  }
}
