feat(server): hot-reload config store and reloadable infra clients
- Replace single Load() with a watching Store that re-reads config files
(and config.local.yaml) and fans out a ReloadEvent with a per-field diff
so consumers can decide whether the change is hot-applicable or requires
a process restart.
- Wrap llm, retrieval, vector store, and object storage clients in
Reloadable* shells so the bootstrap can swap their underlying impls when
config changes without re-instantiating handlers.
- Make jwt.Manager and ops TokenIssuer mutable under a lock so secrets and
TTLs can be rotated live; thread default plan code through a setter on
the ops AdminUserService.
- Wire ConfigStore through bootstrap and every cmd/main.go, scheduler /
worker / tenant-api / ops-api start the watcher; services and handlers
take a config.Provider so they always read current values for things
like generation.stream_enabled, scheduler dispatch, retrieval, etc.
- Switch shared/config decoding off viper to a Kratos-derived runtime
package so env placeholders (\${VAR:default}) resolve consistently and
the same source machinery powers both the loader and the watcher.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -77,7 +77,8 @@ func (s *KnowledgeService) parseWebsiteKnowledge(ctx context.Context, rawURL str
|
||||
}
|
||||
|
||||
func (s *KnowledgeService) executeLinkReader(ctx context.Context, rawURL string) (*arkWebDataItem, error) {
|
||||
baseURL := strings.TrimRight(strings.TrimSpace(s.arkBaseURL), "/")
|
||||
runtimeCfg := s.runtimeConfig()
|
||||
baseURL := strings.TrimRight(strings.TrimSpace(runtimeCfg.ArkBaseURL), "/")
|
||||
if baseURL == "" {
|
||||
baseURL = defaultKnowledgeArkBaseURL
|
||||
}
|
||||
@@ -102,7 +103,7 @@ func (s *KnowledgeService) executeLinkReader(ctx context.Context, rawURL string)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("create webpage parser request: %w", err)
|
||||
}
|
||||
req.Header.Set("Authorization", "Bearer "+s.arkAPIKey)
|
||||
req.Header.Set("Authorization", "Bearer "+runtimeCfg.ArkAPIKey)
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
|
||||
resp, err := s.httpClient.Do(req)
|
||||
@@ -146,9 +147,10 @@ func (s *KnowledgeService) formatWebsiteMarkdown(ctx context.Context, title, con
|
||||
}
|
||||
|
||||
sections := make([]string, 0, len(chunks)+1)
|
||||
runtimeCfg := s.runtimeConfig()
|
||||
for index, chunk := range chunks {
|
||||
result, err := s.llmClient.Generate(ctx, llm.GenerateRequest{
|
||||
Model: s.urlMarkdownModel,
|
||||
Model: runtimeCfg.URLMarkdownModel,
|
||||
Prompt: prompts.KnowledgeWebsiteMarkdownPrompt(title, rawURL, chunk, index, len(chunks)),
|
||||
Timeout: defaultKnowledgeURLMarkdownTimeout,
|
||||
MaxOutputTokens: defaultKnowledgeURLMarkdownOutputToken,
|
||||
|
||||
Reference in New Issue
Block a user