Files
runny 9058149576
Build & Publish (dsh-academy) / End-to-end inside dsh (latest, advisory) (push) Skipped
CLI / test (macos-latest / go 1.26) (push) Canceled after 0s
CLI / test (ubuntu-latest / go 1.26) (push) Canceled after 0s
CLI / test (windows-latest / go 1.26) (push) Canceled after 0s
Build and Push Docker Image / build-ui (push) Canceled after 0s
Build and Push Docker Image / build-docreader (push) Canceled after 0s
Build and Push Docker Image / build-sandbox (push) Canceled after 0s
Build and Push Docker Image / build-app (amd64, linux/amd64, ubuntu-latest) (push) Canceled after 0s
Build and Push Docker Image / build-app (arm64, linux/arm64, ubuntu-24.04-arm) (push) Canceled after 0s
Build and Push Docker Image / merge (push) Canceled after 0s
Frontend / Test, type-check, and build (push) Canceled after 0s
Frontend / Docker multi-stage image (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.10) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.11) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.12) (push) Canceled after 0s
Build & Publish (mcp-server) / Test (Python 3.13) (push) Canceled after 0s
Build & Publish (mcp-server) / Build sdist + wheel (push) Canceled after 0s
Build & Publish (mcp-server) / Publish to PyPI (push) Canceled after 0s
Anydoc / anydoc parser engine (push) Canceled after 0s
App / Format, vet, test, and build (push) Canceled after 0s
DocReader / Python tests and Go client tests (push) Canceled after 0s
Build & Publish (dsh-academy) / Typecheck, test, pack (push) Canceled after 0s
Build & Publish (dsh-academy) / End-to-end inside dsh (pinned) (push) Canceled after 0s
Build & Publish (dsh-academy) / Publish to npm (push) Canceled after 0s
Go Lint Cache / warm lint cache (.) (push) Canceled after 0s
Go Lint Cache / warm lint cache (cli) (push) Canceled after 0s
Go Lint Cache / warm lint cache (client) (push) Canceled after 0s
Helm / chart (push) Canceled after 0s
refactor: 项目更名 WeKnora → Academy
- 全量替换代码/配置/文档中的项目名(保留上游 GitHub 链接、weixin 文档域名、Docker Hub 镜像名)
- 重命名 32 个含项目名的文件/目录;Go module 路径改为 academy(含 client/cli 子模块)
- docreader proto 描述符采用等长替换,保持序列化字节布局有效
- Dockerfile.app 构建网络修复: browserskill 离线产物通道、PyPI/apt 国内镜像
- 运行验证: go build ✓ docker compose up ✓ 健康检查 ✓
2026-11-13 20:52:51 +08:00

63 lines
2.6 KiB
Go

package handler
import (
"net/http"
"strings"
"academy/internal/application/service"
"github.com/gin-gonic/gin"
)
// ListSystemSettingSummaries godoc
// @Summary 查询系统设置
// @Description 返回已注册的系统设置及脱敏值,可按完整设置键过滤
// @Tags System Admin
// @Produce json
// @Param key query string false "完整设置键;省略返回所有已注册设置" extensions(x-agent)
// @Success 200 {array} github_com_Tencent_Academy_internal_types.SystemSettingSummary
// @x-agent {"id":"system_admin.list_settings","risk":"read","system_admin":true,"max_items":100}
// @x-agent-hint "Reads registered platform settings, optionally selecting an exact key from this list. value_json encodes the settings page value, including service fallbacks; it is not proof that a running process has reloaded a restart-required change. value_hidden means secret, invalid or oversized and never means empty/default. Unknown out-of-band database rows are excluded. Read-only: cannot change or reset settings."
// @Router /system/admin/settings-summary [get]
func (h *SystemHandler) ListSystemSettingSummaries(c *gin.Context) {
rows, err := h.systemSettingSvc.List(c.Request.Context())
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": "Failed to list system settings"})
return
}
key := strings.TrimSpace(c.Query("key"))
result := service.SummarizeSystemSettings(rows, key)
if key != "" && len(result) == 0 {
c.JSON(http.StatusNotFound, gin.H{"error": "Unknown setting key"})
return
}
c.JSON(http.StatusOK, result)
}
// Return categories only. Never echo a substring of an upstream error: it may
// include credentials, signed URLs or document content. Categories are hints.
func runtimeErrorCategory(raw string) string {
if raw == "" {
return "none"
}
s := strings.ToLower(raw)
switch {
case strings.Contains(s, "rate limit"), strings.Contains(s, "too many requests"), strings.Contains(s, "status 429"):
return "rate_limited"
case strings.Contains(s, "deadline exceeded"), strings.Contains(s, "timeout"), strings.Contains(s, "timed out"):
return "timeout"
case strings.Contains(s, "unauthorized"),
strings.Contains(s, "authentication"),
strings.Contains(s, "permission denied"),
strings.Contains(s, "forbidden"):
return "access_denied"
case strings.Contains(s, "connection refused"),
strings.Contains(s, "no such host"),
strings.Contains(s, "network unreachable"):
return "connection_failed"
case strings.Contains(s, "not found"), strings.Contains(s, "no such file"):
return "not_found"
default:
return "unknown"
}
}