mirror of
https://github.com/jasonxu114514/opencode2api.git
synced 2026-12-06 08:03:47 +00:00
feat: improve stream monitoring and model catalog reliability
This commit is contained in:
1 parent
3be4b393c0
commit
2c87495826
8 files changed
+640
-80
No files matched your search
@@ -85,6 +85,11 @@ func NewRuntimeManager(root context.Context, configPath string, cfg Config, logg
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := runtime.gateway.catalog.LoadCache(modelCatalogCachePath(configPath)); err != nil && !os.IsNotExist(err) {
|
||||
if manager.logger != nil {
|
||||
manager.logger.Warn("model catalog cache ignored", "component", "models", "event", "catalog_cache_load_failed", "path", modelCatalogCachePath(configPath), "error", err)
|
||||
}
|
||||
}
|
||||
manager.current.Store(runtime)
|
||||
manager.redactor.Replace(cfg)
|
||||
setLogLevel(manager.level, cfg.Logging.Level)
|
||||
@@ -99,6 +104,7 @@ func (m *RuntimeManager) build(cfg Config) (*gatewayRuntime, error) {
|
||||
return nil, err
|
||||
}
|
||||
gateway.catalog.metadata = m.metadata
|
||||
gateway.catalog.SetCachePath(modelCatalogCachePath(m.configPath))
|
||||
return &gatewayRuntime{config: cfg, gateway: gateway, handler: gateway.Handler(), cancel: func() {}}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user