清除多余配置
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
[POST]
|
||||
cacheable = false
|
||||
auth_required = true
|
||||
summary = "修改密码"
|
||||
docstring = "验证旧密码后更新为新密码"
|
||||
params = ["user_id: str", "old_password: str", "new_password: str"]
|
||||
|
||||
[POST.response_model]
|
||||
result = {type = "str", required = true}
|
||||
message = {type = "str", required = true}
|
||||
timestamp = {type = "float", required = false}
|
||||
@@ -1,21 +0,0 @@
|
||||
# ====== 插件注册信息(控制加载方式) ======
|
||||
[workers]
|
||||
type = "auth"
|
||||
module = "plugins.auth"
|
||||
factory = "create_workers"
|
||||
cleanup = "cleanup"
|
||||
count = 0
|
||||
|
||||
[worker]
|
||||
name = "auth"
|
||||
version = "0.1.0"
|
||||
description = "鉴权管理"
|
||||
config_version = "1.0"
|
||||
defaults = { method = "GET", ttl = 30, timeout = 2.0, auth_required = true, cacheable = false }
|
||||
|
||||
[worker.registration]
|
||||
router_prefix = "/auth"
|
||||
tags = ["auth"]
|
||||
|
||||
# ====== Worker 运行时配置(由 lifespan_setup 传递给 create_workers) ======
|
||||
[workers.config]
|
||||
@@ -1,21 +0,0 @@
|
||||
[GET]
|
||||
cacheable = false
|
||||
auth_required = true
|
||||
summary = "获取当前用户信息"
|
||||
docstring = "根据用户ID获取用户详细信息"
|
||||
params = ["user_id: str"]
|
||||
|
||||
[GET.response_model]
|
||||
result = {type = "str", required = true}
|
||||
id = {type = "str", required = true}
|
||||
username = {type = "str", required = true}
|
||||
email = {type = "str", required = true}
|
||||
full_name = {type = "str", required = false}
|
||||
avatar_url = {type = "str", required = false}
|
||||
phone = {type = "str", required = false}
|
||||
is_active = {type = "bool", required = true}
|
||||
is_verified = {type = "bool", required = true}
|
||||
is_superuser = {type = "bool", required = true}
|
||||
created_at = {type = "str", required = false}
|
||||
updated_at = {type = "str", required = false}
|
||||
last_login_at = {type = "str", required = false}
|
||||
@@ -1,12 +0,0 @@
|
||||
[POST]
|
||||
cacheable = false
|
||||
auth_required = false
|
||||
summary = "用户注册"
|
||||
docstring = "创建新用户账号,用户名和邮箱必须唯一"
|
||||
params = ["username: str", "password: str", "email: str", "full_name: str", "phone: str"]
|
||||
|
||||
[POST.response_model]
|
||||
result = {type = "str", required = true}
|
||||
message = {type = "str", required = true}
|
||||
user_id = {type = "str", required = false}
|
||||
timestamp = {type = "float", required = false}
|
||||
@@ -1,11 +0,0 @@
|
||||
[POST]
|
||||
cacheable = false
|
||||
auth_required = true
|
||||
summary = "更新用户资料"
|
||||
docstring = "更新当前用户的基本资料信息(全名、邮箱、头像、手机号)"
|
||||
params = ["user_id: str", "full_name: str", "email: str", "avatar_url: str", "phone: str"]
|
||||
|
||||
[POST.response_model]
|
||||
result = {type = "str", required = true}
|
||||
message = {type = "str", required = true}
|
||||
timestamp = {type = "float", required = false}
|
||||
@@ -1,34 +0,0 @@
|
||||
# ====== 插件注册信息(控制加载方式) ======
|
||||
[workers]
|
||||
type = "auth_oauth"
|
||||
module = "plugins.auth_oauth"
|
||||
factory = "create_workers"
|
||||
cleanup = "cleanup"
|
||||
count = 0
|
||||
# 身份源插件持有签名密钥的使用方(issue_token),走 inline 与网关同信任域;
|
||||
# external 部署前需先解决密钥下发问题(见插件 README 安全说明)
|
||||
load_mode = "inline"
|
||||
|
||||
[worker]
|
||||
name = "auth_oauth"
|
||||
version = "0.1.0"
|
||||
description = "第三方授权登录示例(GitHub OAuth / 手机验证码)"
|
||||
config_version = "1.0"
|
||||
defaults = { method = "GET", ttl = 30, timeout = 10.0, auth_required = false, cacheable = false }
|
||||
|
||||
[worker.registration]
|
||||
router_prefix = "/auth/oauth"
|
||||
tags = ["auth_oauth"]
|
||||
|
||||
# ====== Worker 运行时配置 ======
|
||||
[workers.config]
|
||||
data_dir = "./data"
|
||||
# 演示模式:验证码随响应返回(无短信通道的本地演示)。生产必须置 false 并接真实短信通道
|
||||
return_otp_in_response = true
|
||||
|
||||
# GitHub OAuth App 凭据(https://github.com/settings/developers 创建)
|
||||
[workers.config.github]
|
||||
client_id = "your-github-oauth-client-id"
|
||||
client_secret = "your-github-oauth-client-secret"
|
||||
redirect_uri = "http://localhost:5173/auth/oauth/github/callback"
|
||||
scope = "read:user user:email"
|
||||
@@ -1,5 +0,0 @@
|
||||
[GET]
|
||||
summary = "GitHub 授权登录:生成授权跳转 URL"
|
||||
docstring = "生成 GitHub OAuth 授权链接(含防 CSRF 的 state,存共享缓存 300s)。前端拿 authorize_url 自行跳转。"
|
||||
auth_required = false
|
||||
cacheable = false
|
||||
@@ -1,12 +0,0 @@
|
||||
[POST]
|
||||
summary = "GitHub 授权回调:换取用户信息并签发平台 token"
|
||||
docstring = "前端收到 GitHub 回跳的 code+state 后调用;校验 state(一次性)、换取用户信息、按绑定关系 find-or-create 账号,签发与内置登录同契约的平台 token。"
|
||||
auth_required = false
|
||||
cacheable = false
|
||||
params = ["code: str", "state: str"]
|
||||
|
||||
[POST.response_model]
|
||||
result = { type = "str", required = true }
|
||||
token = { type = "str", required = true }
|
||||
message = { type = "str", required = true }
|
||||
timestamp = { type = "float", required = false }
|
||||
@@ -1,12 +0,0 @@
|
||||
[POST]
|
||||
summary = "手机验证码登录:校验验证码并签发平台 token"
|
||||
docstring = "校验一次性验证码后,按手机号绑定关系 find-or-create 账号,签发与内置登录同契约的平台 token。"
|
||||
auth_required = false
|
||||
cacheable = false
|
||||
params = ["phone: str", "code: str"]
|
||||
|
||||
[POST.response_model]
|
||||
result = { type = "str", required = true }
|
||||
token = { type = "str", required = true }
|
||||
message = { type = "str", required = true }
|
||||
timestamp = { type = "float", required = false }
|
||||
@@ -1,12 +0,0 @@
|
||||
[POST]
|
||||
summary = "手机验证码登录:下发验证码"
|
||||
docstring = "生成 6 位验证码存共享缓存(300s)。演示模式随响应返回 dev_code,生产接短信通道后返回 dev_code=null。"
|
||||
auth_required = false
|
||||
cacheable = false
|
||||
params = ["phone: str"]
|
||||
|
||||
[POST.response_model]
|
||||
result = { type = "str", required = true }
|
||||
message = { type = "str", required = true }
|
||||
expires_in = { type = "int", required = false, default = 300 }
|
||||
dev_code = { type = "str", required = false }
|
||||
@@ -1,9 +0,0 @@
|
||||
[POST]
|
||||
summary = "分析图片内容"
|
||||
docstring = "发送图片(base64或路径)到豆包视觉模型,返回描述"
|
||||
auth_required = false
|
||||
params = [
|
||||
"image_base64: str",
|
||||
"prompt: str"
|
||||
]
|
||||
response_model = { result = { type = "str", required = true }, error = { type = "str", required = false, default = "" } }
|
||||
@@ -1,39 +0,0 @@
|
||||
# ====== 插件注册信息(控制加载方式) ======
|
||||
[workers]
|
||||
type = "doubao"
|
||||
module = "plugins.doubao"
|
||||
factory = "create_workers"
|
||||
cleanup = "cleanup"
|
||||
count = 0
|
||||
|
||||
[worker]
|
||||
name = "doubao"
|
||||
version = "0.1.0"
|
||||
description = "火山引擎豆包视觉理解 worker"
|
||||
config_version = "1.0"
|
||||
defaults = { method = "POST", timeout = 30.0, auth_required = false }
|
||||
|
||||
[worker.registration]
|
||||
router_prefix = "/doubao"
|
||||
tags = ["vision", "ai"]
|
||||
|
||||
# is_aicc = true 时启用 AICC 安全通信(端云互信),使用 AsyncOpenAI + AsyncSecureHttpClient
|
||||
# is_aicc = false 时使用标准 Ark SDK(AsyncArk),默认 false
|
||||
|
||||
# ====== Worker 运行时配置(由 lifespan_setup 传递给 create_workers) ======
|
||||
[workers.config]
|
||||
# api_key 请勿提交到仓库:留空时从环境变量 VOLC_ACCESSKEY 读取(代码中兜底)
|
||||
api_key = "PLACEHOLDER-REPLACE-WITH-REAL-DOUBAO-KEY"
|
||||
base_url = "https://ark.cn-beijing.volces.com/api/v3"
|
||||
model = "doubao-seed-evolving"
|
||||
|
||||
# AICC 模式专用配置(按需启用):
|
||||
# is_aicc = true
|
||||
# api_key = "" # AICC 模式的 api_key 同样经 VOLC_ACCESSKEY 提供,勿入库
|
||||
# base_url = "https://<gateway-host>/api/v3"
|
||||
# model = "ep-xxx"
|
||||
# ra_url = "" # 远程证明地址(独立于 base_url 时配置)
|
||||
# ra_service_name = "AICC.ConfidentialInference"
|
||||
# ra_policy_id = "router_policy"
|
||||
# ak = "" # 火山引擎 AK(TOP 网关鉴权模式)
|
||||
# sk = "" # 火山引擎 SK(TOP 网关鉴权模式)
|
||||
@@ -1,34 +0,0 @@
|
||||
# add 接口 — 按请求类型分节
|
||||
# subject 会带上方法后缀: example.add.GET / example.add.POST
|
||||
|
||||
[GET]
|
||||
cacheable = true
|
||||
summary = "Add two numbers"
|
||||
docstring = "Add two numbers via GET query params"
|
||||
params = ["a: float", "b: float"]
|
||||
auth_required = false
|
||||
validate = false
|
||||
|
||||
[GET.response_model]
|
||||
result = { type = "float", required = true }
|
||||
operation = { type = "str", default = "add" }
|
||||
timestamp = { type = "float", required = false, default = 0.0 }
|
||||
|
||||
[POST]
|
||||
cacheable = true
|
||||
summary = "Add two numbers (POST)"
|
||||
docstring = "Add two numbers via POST JSON body"
|
||||
params = ["a: float", "b: float"]
|
||||
auth_required = true
|
||||
|
||||
[POST.response_model]
|
||||
result = { type = "float", required = true }
|
||||
operation = { type = "str", default = "add" }
|
||||
timestamp = { type = "float", required = false, default = 0.0 }
|
||||
|
||||
# --- MQTT 端点(不注册 HTTP 路由,仅通过 MQTT chongming/example/add 调用)---
|
||||
[MQTT]
|
||||
summary = "Add two numbers via MQTT"
|
||||
docstring = "通过 MQTT 主题 chongming/example/add 调用,载荷为 JSON"
|
||||
params = ["a: float", "b: float"]
|
||||
auth_required = false
|
||||
@@ -1,27 +0,0 @@
|
||||
# ====== 插件注册信息(控制加载方式) ======
|
||||
[workers]
|
||||
type = "example"
|
||||
module = "plugins.example"
|
||||
factory = "create_workers"
|
||||
cleanup = "cleanup"
|
||||
count = 0
|
||||
# 运行模式(按插件粒度,两种模式可同时存在):
|
||||
# "inline"(默认)= 网关进程内加载
|
||||
# "external" = 独立进程运行(Docker/K8s 编排: uv run worker_serve --type example),
|
||||
# 经 Zenoh 注册路由,网关动态挂载
|
||||
load_mode = "inline"
|
||||
|
||||
[worker]
|
||||
name = "example"
|
||||
version = "0.1.0"
|
||||
description = "chongming worker example — demonstrates new config features"
|
||||
config_version = "1.0"
|
||||
defaults = { method = "GET", ttl = 30, timeout = 2.0, auth_required = true, cacheable = false, internal = false }
|
||||
|
||||
[worker.registration]
|
||||
router_prefix = "/calc"
|
||||
tags = ["example"]
|
||||
|
||||
# ====== Worker 运行时配置(由 lifespan_setup 传递给 create_workers) ======
|
||||
[workers.config]
|
||||
data_dir = "./data"
|
||||
@@ -1,6 +0,0 @@
|
||||
# count.toml
|
||||
[GET]
|
||||
summary = "Get visit count and increment"
|
||||
docstring = "Increments a counter and returns current value"
|
||||
params = [] # 无参数
|
||||
response_model = { name = { type = "str", required = true }, value = { type = "int", required = true } }
|
||||
@@ -1,12 +0,0 @@
|
||||
# divide 接口
|
||||
|
||||
[GET]
|
||||
summary = "Divide two numbers"
|
||||
docstring = "Divide two numbers via GET query params (a / b). Returns error if b == 0."
|
||||
params = ["a: float", "b: float"]
|
||||
|
||||
[GET.response_model]
|
||||
result = { type = "float", required = false, default = 0.0 }
|
||||
operation = { type = "str", default = "divide" }
|
||||
timestamp = { type = "float", required = false, default = 0.0 }
|
||||
error = { type = "str", required = false, default = "" }
|
||||
@@ -1,7 +0,0 @@
|
||||
# heartbeat 接口 — MQTT 心跳上报,无响应
|
||||
|
||||
[MQTT]
|
||||
summary = "Heartbeat ping (no response)"
|
||||
docstring = "通过 MQTT 主题 chongming/example/heartbeat 上报心跳,不返回响应"
|
||||
params = ["worker_id: str"]
|
||||
auth_required = false
|
||||
@@ -1,11 +0,0 @@
|
||||
# multiply 接口
|
||||
|
||||
[GET]
|
||||
summary = "Multiply two numbers"
|
||||
docstring = "Multiply two numbers via GET query params (a * b)"
|
||||
params = ["a: float", "b: float"]
|
||||
|
||||
[GET.response_model]
|
||||
result = { type = "float", required = true }
|
||||
operation = { type = "str", default = "multiply" }
|
||||
timestamp = { type = "float", required = false, default = 0.0 }
|
||||
@@ -1,13 +0,0 @@
|
||||
[POST]
|
||||
summary = "模拟 AI 流式对话(SSE,逐 token 输出)"
|
||||
docstring = "流式端点示例:@rpc_method 返回生成器,框架逐块多回复推送,网关以 text/event-stream 转发。curl -N 可观察逐块到达。"
|
||||
auth_required = false
|
||||
stream = true
|
||||
# 流式超时模型: timeout = 流总寿命上限(zenoh query deadline),
|
||||
# stream_idle_timeout = 网关侧连续无数据块的最大间隔
|
||||
timeout = 300.0
|
||||
stream_idle_timeout = 10.0
|
||||
params = [
|
||||
"prompt: str",
|
||||
"tokens: int"
|
||||
]
|
||||
@@ -1,11 +0,0 @@
|
||||
# subtract 接口
|
||||
|
||||
[GET]
|
||||
summary = "Subtract two numbers"
|
||||
docstring = "Subtract two numbers via GET query params (a - b)"
|
||||
params = ["a: float", "b: float"]
|
||||
|
||||
[GET.response_model]
|
||||
result = { type = "float", required = true }
|
||||
operation = { type = "str", default = "subtract" }
|
||||
timestamp = { type = "float", required = false, default = 0.0 }
|
||||
Reference in New Issue
Block a user