返回 DeepSeek-Reasonix
model_settings.go
根目录 / internal / boot / model_settings.go
1 package boot
2
3 import (
4 "fmt"
5 "reasonix/internal/config"
6 "reasonix/internal/provider"
7 )
8
9 func runtimeModelContinuationReader(root, modelName string, old *config.Config, settings *config.ModelRuntimeSettings, externalResolvers ...provider.Resolver) func() error {
10 return func() error {
11 for _, resolver := range externalResolvers {
12 if resolver != nil {
13 return fmt.Errorf("external model routes cannot verify continued credential access; apply the new settings first")
14 }
15 }
16 current, err := config.LoadModelRuntimeSnapshot(root, modelName)
17 if err != nil {
18 return err
19 }
20 if err := settings.Apply(current, root); err != nil {
21 return err
22 }
23 return config.ValidateModelRuntimeContinuation(old, current)
24 }
25 }
26
27 func runtimeModelSettingsReader(root, modelName, modelRef string, settings *config.ModelRuntimeSettings) func() (string, error) {
28 return func() (string, error) {
29 current, err := config.LoadModelRuntimeSnapshot(root, modelName)
30 if err != nil {
31 return "", err
32 }
33 if err := settings.Apply(current, root); err != nil {
34 return "", err
35 }
36 return current.ModelRuntimeFingerprint(modelRef), nil
37 }
38 }
39
40 func runtimeImageCapabilityReader(root, modelName, snapshot string, settings *config.ModelRuntimeSettings) func() bool {
41 return func() bool {
42 current, err := config.LoadForRootReadOnly(root)
43 if err == nil {
44 err = settings.Apply(current, root)
45 }
46 if err != nil {
47 return false
48 }
49 config.NormalizeLegacyMimoCustomProvidersForRefs(current, modelName)
50 return config.ModelCapabilitySnapshot(current, config.NewModelCapabilityResolver()) != snapshot
51 }
52 }
53
53 lines GO