0.11.1: 旗舰版完善(资源权限等级/个人环境变量/收藏/企业报表/租户概览/ARM64发布/多渠道接入)
- 迁移 000035-000037(权限等级/环境变量/渠道) - 新增 internal/channel 渠道抽象层(webhook/企微/钉钉/飞书) - 全部功能端到端验证通过(25 包单测)
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
"time"
|
||||
|
||||
"aigateway.local/core/internal/agentnode"
|
||||
"aigateway.local/core/internal/channel"
|
||||
"aigateway.local/core/internal/assistant"
|
||||
"aigateway.local/core/internal/apikey"
|
||||
"aigateway.local/core/internal/audit"
|
||||
@@ -255,6 +256,15 @@ func main() {
|
||||
logger.Error("notification encryption initialization failed", "error", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
envVarCipher, err := cryptox.NewKeyring(
|
||||
cfg.Credentials.MasterKey, cfg.Credentials.KEKVersion, cfg.Credentials.KEKKeyring, "user-env-var",
|
||||
)
|
||||
if err != nil {
|
||||
logger.Error("user env var encryption initialization failed", "error", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
envVarService := workbench.NewEnvVarService(db, envVarCipher)
|
||||
envVarHandler := workbench.NewEnvVarHTTPHandler(envVarService, identityService)
|
||||
toolService := workbench.NewToolService(workbenchService, toolCipher, cfg.Credentials.AllowPrivateToolURL)
|
||||
notificationService := workbench.NewNotificationService(workbenchService, notificationCipher, cfg.Credentials.AllowPrivateWebhookURL)
|
||||
workbenchHandler := workbench.NewAdminHTTPHandler(workbenchService, toolService, notificationService, identityService)
|
||||
@@ -319,6 +329,16 @@ func main() {
|
||||
logger.Error("application runtime credential initialization failed", "error", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
channelCipher, err := cryptox.NewKeyring(
|
||||
cfg.Credentials.MasterKey, cfg.Credentials.KEKVersion, cfg.Credentials.KEKKeyring, "channel-config",
|
||||
)
|
||||
if err != nil {
|
||||
logger.Error("channel encryption initialization failed", "error", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
channelService := channel.NewService(db, cfg.Scheduler.GatewayBaseURL, channelCipher, logger)
|
||||
channelHandler := channel.NewHTTPHandler(channelService, identityService)
|
||||
channelInboundHandler := channel.NewInboundHTTPHandler(channelService)
|
||||
shadowMiddleware := shadow.New(cfg.Shadow, logger)
|
||||
governedGateway := shadowMiddleware.Wrap(proxy)
|
||||
workbenchRuntime := workbench.NewRuntimeHTTPHandler(workbenchService, toolService, workbench.NewRetriever(workbenchService, workbenchService.Embedder()), apiKeyAuthenticator, governedGateway, workbench.MarketplaceDeps{
|
||||
@@ -330,11 +350,13 @@ func main() {
|
||||
})
|
||||
workbenchRuntime.SetLogger(logger)
|
||||
workbenchRuntime.SetTraceStore(traceStore)
|
||||
workbenchRuntime.SetEnvVarService(envVarService)
|
||||
// Wire the fact-check engine: the admin fact-check settings/policies UI now
|
||||
// actually governs application answers instead of being inert configuration.
|
||||
factCheckEngine := factcheck.NewEngine(db, workbench.NewFactCheckRetriever(workbench.NewRetriever(workbenchService, workbenchService.Embedder())), logger)
|
||||
workbenchRuntime.SetFactCheckEngine(factCheckEngine)
|
||||
portalService := portal.NewService(db, workbenchService, toolService, identityService)
|
||||
portalService.SetEnvVarService(envVarService)
|
||||
portalService.SetApplicationRuntime(portal.NewRuntimeCredentials(db, apiKeyRepository, applicationKeyCipher), workbenchRuntime)
|
||||
portalService.SetMarketplace(marketplaceService)
|
||||
portalHandler := portal.NewHTTPHandler(portalService, identityService)
|
||||
@@ -399,6 +421,7 @@ func main() {
|
||||
controlMux.Handle("/api/v1/admin/model-requests/", portalAdminHandler)
|
||||
controlMux.Handle("/api/v1/admin/system-info", operationsHandler)
|
||||
controlMux.Handle("/api/v1/admin/monitoring/overview", operationsHandler)
|
||||
controlMux.Handle("/api/v1/admin/tenants/", operationsHandler)
|
||||
controlMux.Handle("/api/v1/admin/files", filesAdminHandler)
|
||||
controlMux.Handle("/api/v1/admin/files/", filesAdminHandler)
|
||||
controlMux.Handle("/api/v1/portal/files", filesPortalHandler)
|
||||
@@ -417,6 +440,8 @@ func main() {
|
||||
controlMux.Handle("/api/v1/admin/agent-nodes", agentNodeHandler)
|
||||
controlMux.Handle("/api/v1/admin/agent-nodes/", agentNodeHandler)
|
||||
controlMux.Handle("/api/v1/agent/nodes/", agentNodeHandler)
|
||||
controlMux.Handle("/api/v1/admin/channels", channelHandler)
|
||||
controlMux.Handle("/api/v1/admin/channels/", channelHandler)
|
||||
controlMux.Handle("/api/v1/admin/assistant", assistantHandler)
|
||||
controlMux.Handle("/api/v1/admin/assistant/", assistantHandler)
|
||||
controlMux.Handle("/api/v1/admin/license", licenseHandler)
|
||||
@@ -440,6 +465,8 @@ func main() {
|
||||
controlMux.Handle("/api/v1/portal/logs", portalHandler)
|
||||
controlMux.Handle("/api/v1/portal/logs/", portalHandler)
|
||||
controlMux.Handle("/api/v1/portal/model-requests", portalHandler)
|
||||
controlMux.Handle("/api/v1/portal/env-vars", envVarHandler)
|
||||
controlMux.Handle("/api/v1/portal/env-vars/", envVarHandler)
|
||||
controlMux.Handle("/api/v1/portal/memories", memoryHandler)
|
||||
controlMux.Handle("/api/v1/portal/memories/", memoryHandler)
|
||||
controlMux.Handle("/api/v1/portal/model-requests/", portalHandler)
|
||||
@@ -459,6 +486,7 @@ func main() {
|
||||
publicMux.Handle("/v1/skills/", workbenchRuntime)
|
||||
publicMux.Handle("/v1/mcp-servers", workbenchRuntime)
|
||||
publicMux.Handle("/v1/mcp-servers/", workbenchRuntime)
|
||||
publicMux.Handle("/v1/channels/", channelInboundHandler)
|
||||
publicMux.Handle("/v1/digital-employees/", workbenchRuntime)
|
||||
publicMux.Handle("/v1/", governedGateway)
|
||||
server := httpserver.New(httpserver.Dependencies{
|
||||
|
||||
Reference in New Issue
Block a user