Cut over public engine construction to ConfigKit sources
This commit is contained in:
@@ -25,7 +25,16 @@ func (r *Runner) resolvePromptDefinition(
|
||||
return nil, fmt.Errorf("%w: prompt repository is not configured", ErrPromptLoad)
|
||||
}
|
||||
|
||||
definition, err := r.promptDefs.GetPromptDefinition(ctx, promptID, promptVersion)
|
||||
var definition *domain.PromptDefinition
|
||||
var hash string
|
||||
var err error
|
||||
if indexed, ok := r.promptDefs.(interface {
|
||||
GetPromptSnapshot(context.Context, string, string) (*domain.PromptDefinition, string, error)
|
||||
}); ok {
|
||||
definition, hash, err = indexed.GetPromptSnapshot(ctx, promptID, promptVersion)
|
||||
} else {
|
||||
definition, err = r.promptDefs.GetPromptDefinition(ctx, promptID, promptVersion)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%w: %w", ErrPromptLoad, err)
|
||||
}
|
||||
@@ -33,9 +42,11 @@ func (r *Runner) resolvePromptDefinition(
|
||||
return nil, fmt.Errorf("%w: prompt repository returned nil definition", ErrPromptLoad)
|
||||
}
|
||||
|
||||
hash, err := hashPromptDefinition(definition)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%w: failed to hash prompt definition: %v", ErrPromptLoad, err)
|
||||
if hash == "" {
|
||||
hash, err = hashPromptDefinition(definition)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%w: failed to hash prompt definition: %v", ErrPromptLoad, err)
|
||||
}
|
||||
}
|
||||
return &resolvedPromptDefinition{definition: definition, hash: hash}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user