revive ai, config*.go
parent
80df07089f
commit
a674022357
|
|
@ -3,6 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
|
@ -28,8 +29,6 @@ type Config struct {
|
||||||
AssetPattern string
|
AssetPattern string
|
||||||
DatacenterPattern string
|
DatacenterPattern string
|
||||||
EventNamePattern string
|
EventNamePattern string
|
||||||
storage Storage
|
|
||||||
queue Queue
|
|
||||||
driver Driver
|
driver Driver
|
||||||
ai AI
|
ai AI
|
||||||
}
|
}
|
||||||
|
|
@ -112,13 +111,11 @@ func newConfigFromEnv(ctx context.Context, getEnv func(string) string) (Config,
|
||||||
}
|
}
|
||||||
result.driver = driver
|
result.driver = driver
|
||||||
if !result.FillWithTestdata {
|
if !result.FillWithTestdata {
|
||||||
} else if err := result.driver.FillWithTestdata(ctx, result.AssetPattern, result.DatacenterPattern, result.EventNamePattern); err != nil {
|
//} else if err := result.driver.FillWithTestdata(ctx, result.AssetPattern, result.DatacenterPattern, result.EventNamePattern); err != nil {
|
||||||
return Config{}, err
|
} else {
|
||||||
|
return Config{}, errors.New("not impl")
|
||||||
}
|
}
|
||||||
|
|
||||||
result.storage = NewStorage(result.driver)
|
|
||||||
result.queue = NewQueue(result.driver)
|
|
||||||
|
|
||||||
if result.OllamaURL != "" {
|
if result.OllamaURL != "" {
|
||||||
result.ai = NewAIOllama(result.OllamaURL, result.OllamaModel)
|
result.ai = NewAIOllama(result.OllamaURL, result.OllamaModel)
|
||||||
} else if result.LocalCheckpoint != "" && result.LocalTokenizer != "" {
|
} else if result.LocalCheckpoint != "" && result.LocalTokenizer != "" {
|
||||||
Loading…
Reference in New Issue