Store one prompt definition per ID
This commit is contained in:
@@ -22,12 +22,9 @@ func TestLoadedListsSortedEffectiveIdentities(t *testing.T) {
|
||||
" z/profile ": map[string]any{"backend": "local", "model": "spaced-model"},
|
||||
},
|
||||
"prompts": map[string]any{
|
||||
"z/prompt": map[string]any{"v1": listingPromptDefinition()},
|
||||
"a/prompt": map[string]any{"v1": listingPromptDefinition()},
|
||||
" z/prompt ": map[string]any{
|
||||
"2": listingPromptDefinition(),
|
||||
"10": listingPromptDefinition(),
|
||||
},
|
||||
"z/prompt": listingPromptDefinition(),
|
||||
"a/prompt": listingPromptDefinition(),
|
||||
" z/prompt ": listingPromptDefinition(),
|
||||
},
|
||||
}), nil)
|
||||
if err != nil {
|
||||
@@ -48,8 +45,7 @@ func TestLoadedListsSortedEffectiveIdentities(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
wantPrompts := []domain.PromptIdentity{
|
||||
{ID: " z/prompt ", Version: "10"},
|
||||
{ID: " z/prompt ", Version: "2"},
|
||||
{ID: " z/prompt ", Version: "v1"},
|
||||
{ID: "a/prompt", Version: "v1"},
|
||||
{ID: "z/prompt", Version: "v1"},
|
||||
}
|
||||
@@ -61,7 +57,7 @@ func TestLoadedListsSortedEffectiveIdentities(t *testing.T) {
|
||||
func TestLoadedListsAreIndependent(t *testing.T) {
|
||||
state, err := Load(mapping("identities", map[string]any{
|
||||
"profiles": map[string]any{"profile": map[string]any{}},
|
||||
"prompts": map[string]any{"example": map[string]any{"v1": listingPromptDefinition()}},
|
||||
"prompts": map[string]any{"example": listingPromptDefinition()},
|
||||
}), nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -116,7 +112,7 @@ func TestLoadedListsEmptyInventory(t *testing.T) {
|
||||
func TestLoadedListsHonorCanceledContext(t *testing.T) {
|
||||
state, err := Load(mapping("identities", map[string]any{
|
||||
"profiles": map[string]any{"partial": map[string]any{}},
|
||||
"prompts": map[string]any{"example": map[string]any{"v1": listingPromptDefinition()}},
|
||||
"prompts": map[string]any{"example": listingPromptDefinition()},
|
||||
}), nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -136,6 +132,7 @@ func TestLoadedListsHonorCanceledContext(t *testing.T) {
|
||||
|
||||
func listingPromptDefinition() map[string]any {
|
||||
return map[string]any{
|
||||
"version": "v1",
|
||||
"messages": []any{map[string]any{"role": "user", "content": "Hello."}},
|
||||
"output": map[string]any{"format": "text", "validation_mode": "basic"},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user