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:
@@ -65,3 +65,31 @@ func TestEncodeMonitoringProjectionRebuildEnvelopePreservesBusinessDate(t *testi
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "2026-04-12", envelope.BusinessDate)
|
||||
}
|
||||
|
||||
func TestFilterMonitoringPlatformsReturnsSelectedPlatform(t *testing.T) {
|
||||
platforms := []monitoringPlatformMetadata{
|
||||
{ID: "deepseek", Name: "DeepSeek"},
|
||||
{ID: "qwen", Name: "通义千问"},
|
||||
{ID: "doubao", Name: "豆包"},
|
||||
}
|
||||
selected := "qwen"
|
||||
|
||||
filtered := filterMonitoringPlatforms(platforms, &selected)
|
||||
|
||||
assert.Equal(t, []monitoringPlatformMetadata{
|
||||
{ID: "qwen", Name: "通义千问"},
|
||||
}, filtered)
|
||||
}
|
||||
|
||||
func TestFilterMonitoringPlatformsFallsBackToDisplayName(t *testing.T) {
|
||||
platforms := []monitoringPlatformMetadata{
|
||||
{ID: "deepseek", Name: "DeepSeek"},
|
||||
}
|
||||
selected := "doubao"
|
||||
|
||||
filtered := filterMonitoringPlatforms(platforms, &selected)
|
||||
|
||||
assert.Equal(t, []monitoringPlatformMetadata{
|
||||
{ID: "doubao", Name: "豆包"},
|
||||
}, filtered)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user