Ajout de SEARXNG pour les recherches web
This commit is contained in:
1 parent
87eeb41364
commit
345129c7bf
30 files changed
+919
-166
No files matched your search
+11
-26
@@ -11,14 +11,8 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"trankilou.fr/lassistanoque/backend/internal/brain"
|
||||
"trankilou.fr/lassistanoque/backend/internal/gateway"
|
||||
"trankilou.fr/lassistanoque/backend/internal/http"
|
||||
"trankilou.fr/lassistanoque/backend/internal/service/agent"
|
||||
"trankilou.fr/lassistanoque/backend/internal/service/auth"
|
||||
"trankilou.fr/lassistanoque/backend/internal/service/chat"
|
||||
"trankilou.fr/lassistanoque/backend/internal/service/provider"
|
||||
"trankilou.fr/lassistanoque/backend/internal/service/storage"
|
||||
"trankilou.fr/lassistanoque/backend/internal/service/user"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -44,35 +38,26 @@ func runServe() {
|
||||
|
||||
defer Close()
|
||||
|
||||
// services
|
||||
authService := auth.NewService(GetSettingsRepository(), GetUserRepository(), GetAuthenticators())
|
||||
userService := user.NewService(GetUserRepository())
|
||||
storageService := storage.NewService(GetStorageProvider())
|
||||
providerService := provider.NewService(GetProviderRepository(), GetUserRepository(), GetLLMEngine())
|
||||
agentService := agent.NewService(GetAgentRepository(), GetUserRepository())
|
||||
chatService := chat.NewService(GetUserRepository(), GetAgentRepository(), GetProviderRepository(), GetChatRepository(), GetLLMEngine())
|
||||
|
||||
// http server
|
||||
httpRouter := http.NewRouter(http.Dependencies{
|
||||
StorageService: storageService,
|
||||
AuthService: authService,
|
||||
UserService: userService,
|
||||
ProviderService: providerService,
|
||||
AgentService: agentService,
|
||||
ChatService: chatService,
|
||||
StorageService: GetStorageService(),
|
||||
AuthService: GetAuthService(),
|
||||
UserService: GetUserService(),
|
||||
ProviderService: GetProviderService(),
|
||||
AgentService: GetAgentService(),
|
||||
ChatService: GetChatService(),
|
||||
ToolService: GetToolService(),
|
||||
TokenManager: GetTokenManager(),
|
||||
})
|
||||
|
||||
brainRouter := brain.NewRouter(brain.Dependencies{
|
||||
ChatRepository: GetChatRepository(),
|
||||
})
|
||||
gatewayRouter := gateway.NewRouter(gateway.Dependencies{})
|
||||
|
||||
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
|
||||
defer stop()
|
||||
|
||||
// start Brain router
|
||||
go func() {
|
||||
if err := brainRouter.Start(); err != nil && !errors.Is(err, nethttp.ErrServerClosed) {
|
||||
if err := gatewayRouter.Start(); err != nil && !errors.Is(err, nethttp.ErrServerClosed) {
|
||||
slog.Error("failed to start llm server", "error", err)
|
||||
}
|
||||
}()
|
||||
@@ -97,7 +82,7 @@ func runServe() {
|
||||
// stop LLM service
|
||||
ctx, cancel2 := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel2()
|
||||
if err := brainRouter.Stop(ctx); err != nil {
|
||||
if err := gatewayRouter.Stop(ctx); err != nil {
|
||||
slog.Error("failed to stop llm server", "error", err)
|
||||
}
|
||||
slog.Info("LLM server stopped gracefully")
|
||||
|
||||
Reference in new issue
Block a user