Skip to content

Commit

Permalink
fix: setting model
Browse files Browse the repository at this point in the history
  • Loading branch information
daulet committed Aug 27, 2024
1 parent 0b4aa5e commit 164e84c
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,9 @@ func parseConfig(ctx context.Context) (bool, error) {
fmt.Println(model)
}
fmt.Println()
fmt.Printf("Currently selected model: %s\n", *cfg.Model)
if cfg.Model != nil {
fmt.Printf("Currently selected model: %s\n", *cfg.Model)
}
return true, nil
}

Expand Down Expand Up @@ -279,7 +281,9 @@ func cmd(ctx context.Context) error {
out.Close()
<-done
for _, block := range blocks {
runBlock(block)
if err := runBlock(block); err != nil {
return "", err
}
}

return response, nil
Expand Down Expand Up @@ -338,14 +342,11 @@ func cmd(ctx context.Context) error {
func main() {
flag.Parse()

ctx := context.Background()
done, err := parseConfig(ctx)
// read config first so we can use the right provider
cfg, err := config.ReadConfig()
if err != nil {
panic(err)
}
if done {
return
}

switch cfg.Provider {
case config.ProviderGroq:
Expand All @@ -356,6 +357,15 @@ func main() {
log.Fatalf("unknown provider: %s", cfg.Provider)
}

ctx := context.Background()
done, err := parseConfig(ctx)
if err != nil {
panic(err)
}
if done {
return
}

if cfg.Record {
closer, err := provider.NewCacheProvider(prov, ".cache/cache.json")
if err != nil {
Expand Down

0 comments on commit 164e84c

Please sign in to comment.