33 lines
769 B
Go
33 lines
769 B
Go
package configuration
|
|
|
|
import (
|
|
"context"
|
|
|
|
"gitea.maximumdirect.net/eric/promptkit/internal/domain"
|
|
)
|
|
|
|
func (state *loaded) ListProfiles(ctx context.Context) ([]string, error) {
|
|
if err := ctx.Err(); err != nil {
|
|
return nil, err
|
|
}
|
|
profiles := append([]string(nil), state.profileIDs...)
|
|
if err := ctx.Err(); err != nil {
|
|
return nil, err
|
|
}
|
|
return profiles, nil
|
|
}
|
|
|
|
func (state *loaded) ListPrompts(ctx context.Context) ([]domain.PromptIdentity, error) {
|
|
if err := ctx.Err(); err != nil {
|
|
return nil, err
|
|
}
|
|
prompts := append([]domain.PromptIdentity(nil), state.promptIDs...)
|
|
for index := range prompts {
|
|
prompts[index].Version = stringPointerValue(prompts[index].Version)
|
|
}
|
|
if err := ctx.Err(); err != nil {
|
|
return nil, err
|
|
}
|
|
return prompts, nil
|
|
}
|