feat(prompts): add prompts loader and configuration management

- Implemented a new prompts loader in `loader.go` to manage prompt templates and configurations.
- Introduced caching mechanism for prompt configurations to optimize loading.
- Added functions to apply platform-specific prompt template overrides.
- Created unit tests in `loader_test.go` to validate prompt configuration loading and reloading behavior.
- Ensured that the last valid configuration is retained in case of errors during reload.
This commit is contained in:
2026-04-13 16:08:12 +08:00
parent 6066f43a7d
commit 1b01caac0f
21 changed files with 1630 additions and 392 deletions
+2
View File
@@ -7,6 +7,7 @@ import (
"fmt"
"log"
"os"
"path/filepath"
"strings"
"time"
@@ -94,6 +95,7 @@ func main() {
if err != nil {
log.Fatalf("load config: %v", err)
}
prompts.SetConfigFile(filepath.Join(filepath.Dir(configPath), "prompts.yml"))
ctx := context.Background()
businessPool, err := pgxpool.New(ctx, cfg.Database.DSN())