feat: unify installation model catalog

This commit is contained in:
Codex
2026-09-02 18:45:33 +02:00
parent ae053961a3
commit 7b7927bfe5
169 changed files with 3696 additions and 4572 deletions
+21 -2
View File
@@ -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 {