init: 数字员工平台初始代码

包含前端(Vue3 + VueFlow 画布)、后端(Go)、文档体系。
- 工作台画布:节点拖放、连线模式、右键菜单、AI 助手
- 后端:连接器 API、专员种子数据
- 导航:左侧导航、工坊、市场、控制台
This commit is contained in:
eaiadmin
2026-08-18 20:19:58 +08:00
commit 4e8817d768
239 changed files with 48631 additions and 0 deletions
@@ -0,0 +1,37 @@
package web
import "net/http"
// AppError 业务错误(对齐 Python core/errors.py 的错误码与状态码)
type AppError struct {
StatusCode int
Code string
Message string
}
func (e *AppError) Error() string { return e.Message }
func NewBadRequest(msg string) *AppError {
return &AppError{http.StatusBadRequest, "bad_request", msg}
}
func NewAuthError(msg string) *AppError {
return &AppError{http.StatusUnauthorized, "unauthorized", msg}
}
func NewForbiddenError(msg string) *AppError {
return &AppError{http.StatusForbidden, "forbidden", msg}
}
func NewNotFoundError(msg string) *AppError {
return &AppError{http.StatusNotFound, "not_found", msg}
}
func NewConflictError(msg string) *AppError {
return &AppError{http.StatusConflict, "conflict", msg}
}
func NewLLMNotConfigured(msg string) *AppError {
return &AppError{http.StatusNotImplemented, "llm_not_configured", msg}
}
func NewLLMError(msg string) *AppError {
return &AppError{http.StatusBadGateway, "llm_request_failed", msg}
}
func NewPointsExhausted(msg string) *AppError {
return &AppError{http.StatusPaymentRequired, "ai_points_exhausted", msg}
}
@@ -0,0 +1,17 @@
package web
import (
"net/http"
"github.com/gin-gonic/gin"
)
// OK 成功响应信封 {"data": ..., "error": null, "message": "success"}
func OK(c *gin.Context, data any) {
c.JSON(http.StatusOK, gin.H{"data": data, "error": nil, "message": "success"})
}
// Fail 错误响应信封 {"data": null, "error": ..., "message": ...}
func Fail(c *gin.Context, e *AppError) {
c.JSON(e.StatusCode, gin.H{"data": nil, "error": e.Code, "message": e.Message})
}