feat: unify installation model catalog
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/aritmolab/thothii/tools/tht/internal/config"
|
||||
"github.com/aritmolab/thothii/tools/tht/internal/safeio"
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
@@ -46,6 +47,7 @@ type answers struct {
|
||||
}
|
||||
|
||||
type generatedDescriptor struct {
|
||||
SchemaVersion int `yaml:"schemaVersion"`
|
||||
Profile string `yaml:"profile"`
|
||||
ProjectDirectory string `yaml:"projectDirectory"`
|
||||
EnvFile string `yaml:"envFile"`
|
||||
@@ -62,7 +64,8 @@ type generatedDescriptor struct {
|
||||
GID uint32 `yaml:"gid"`
|
||||
} `yaml:"runtimeProjection,omitempty"`
|
||||
} `yaml:"authentication"`
|
||||
Overrides []string `yaml:"overrides"`
|
||||
ModelCatalog config.ModelCatalog `yaml:"modelCatalog"`
|
||||
Overrides []string `yaml:"overrides"`
|
||||
}
|
||||
|
||||
// EnsureFiles writes a descriptor and non-secret environment file below deploy/<installation-id>.
|
||||
@@ -318,7 +321,7 @@ func installationDirectory(root, id string) (string, error) {
|
||||
}
|
||||
|
||||
func render(root, descriptorPath string, value answers) ([]byte, []byte, error) {
|
||||
descriptor := generatedDescriptor{Profile: value.profile, ProjectDirectory: root, EnvFile: filepath.Join(filepath.Dir(descriptorPath), environmentName)}
|
||||
descriptor := generatedDescriptor{SchemaVersion: 2, Profile: value.profile, ProjectDirectory: root, EnvFile: filepath.Join(filepath.Dir(descriptorPath), environmentName), ModelCatalog: defaultModelCatalog()}
|
||||
descriptor.Workspace.Remote, descriptor.Workspace.Branch, descriptor.Workspace.Access = value.workspaceRemote, value.workspaceBranch, value.workspaceAccess
|
||||
descriptor.Authentication.ConfigDirectory = filepath.Join(filepath.Dir(descriptorPath), "auth")
|
||||
if value.profile == "server" {
|
||||
@@ -372,6 +375,22 @@ func render(root, descriptorPath string, value answers) ([]byte, []byte, error)
|
||||
return descriptorBytes, []byte(strings.Join(lines, "\n") + "\n"), nil
|
||||
}
|
||||
|
||||
func defaultModelCatalog() config.ModelCatalog {
|
||||
return config.ModelCatalog{
|
||||
Defaults: config.ModelCatalogDefaults{Session: "deepseek/deepseek-v4-pro"},
|
||||
Embedding: config.ModelCatalogEmbedding{ID: "ollama/qwen3-embedding:0.6b", Dimensions: 1024},
|
||||
Providers: map[string]config.ModelProvider{
|
||||
"deepseek": {
|
||||
Authentication: config.ModelAuthentication{Mode: "pi_auth"},
|
||||
Session: &config.ModelSessionAdapter{Mode: "pi_builtin"},
|
||||
Models: map[string]config.CatalogModel{
|
||||
"deepseek-v4-pro": {Session: &config.SessionModel{}},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func dotenvValue(value string) string { return strconv.Quote(value) }
|
||||
|
||||
func requireCompatibleOrAbsent(path string, expected []byte) error {
|
||||
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
"github.com/aritmolab/thothii/tools/tht/internal/compose"
|
||||
"github.com/aritmolab/thothii/tools/tht/internal/config"
|
||||
"github.com/aritmolab/thothii/tools/tht/internal/doctor"
|
||||
"github.com/aritmolab/thothii/tools/tht/internal/modelprojection"
|
||||
"github.com/aritmolab/thothii/tools/tht/internal/project"
|
||||
"github.com/aritmolab/thothii/tools/tht/internal/service"
|
||||
)
|
||||
@@ -60,6 +61,9 @@ func Run(ctx context.Context, runner compose.Runner, request Request, input io.R
|
||||
if err := configureAuthentication(ctx, installation, request, input, output); err != nil {
|
||||
return Result{}, err
|
||||
}
|
||||
if err := modelprojection.Generate(installation); err != nil {
|
||||
return Result{}, fmt.Errorf("setup model runtime projection: %w", err)
|
||||
}
|
||||
if err := runCompose(ctx, runner, installation, "config", "--quiet"); err != nil {
|
||||
return Result{}, fmt.Errorf("setup Compose configuration: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user