增加调试前端页面

This commit is contained in:
andy committed 2026-09-06 00:25:25 +08:00
1 parent 3080b17d02
commit ee9d2d7cf1
22 files changed
+1442 -59

No files matched your search

+21
View File
@@ -37,6 +37,18 @@ func New(ctx context.Context, cfg config.Config) (*Application, error) {
routerOptions := handler.RouterOptions{}
closeDependencies := func() {}
if cfg.Chat.PageEnabled {
if !cfg.Chat.Enabled {
return nil, fmt.Errorf("initialize chat page: chat must be enabled")
}
if cfg.Chat.CompatAppID == "" {
return nil, fmt.Errorf("initialize chat page: compatibility app ID is required")
}
if len(cfg.Chat.AllowedOrigins) == 0 {
return nil, fmt.Errorf("initialize chat page: at least one allowed origin is required")
}
}
if cfg.Chat.Enabled {
if !cfg.SuperAgent.Enabled {
return nil, fmt.Errorf("initialize chat: SuperAgent must be enabled")
@@ -96,6 +108,15 @@ func New(ctx context.Context, cfg config.Config) (*Application, error) {
}
routerOptions.DashScopeChat = dashScopeChatHandler
}
if cfg.Chat.PageEnabled {
chatPageHandler, err := handler.NewChatPageHandler(handler.ChatPageOptions{
AppID: cfg.Chat.CompatAppID,
})
if err != nil {
return nil, fmt.Errorf("initialize chat page handler: %w", err)
}
routerOptions.ChatPage = chatPageHandler
}
}
if cfg.MCP.Enabled {