feat(model): Improve error message when model is not configured.

This commit is contained in:
fanlv
2025-07-25 13:18:52 +08:00
parent f3934ccf62
commit 2e2018af7a
6 changed files with 46 additions and 3 deletions

View File

@@ -6,6 +6,7 @@ import (
type Manager interface {
ListModel(ctx context.Context, req *ListModelRequest) (*ListModelResponse, error)
ListInUseModel(ctx context.Context, limit int, Cursor *string) (*ListModelResponse, error)
MGetModelByID(ctx context.Context, req *MGetModelRequest) ([]*Model, error)
}

View File

@@ -26,6 +26,14 @@ type staticModelManager struct {
modelMapping map[int64]*modelmgr.Model
}
func (s *staticModelManager) ListInUseModel(ctx context.Context, limit int, Cursor *string) (*modelmgr.ListModelResponse, error) {
return s.ListModel(ctx, &modelmgr.ListModelRequest{
Status: []modelmgr.ModelStatus{modelmgr.StatusInUse},
Limit: limit,
Cursor: Cursor,
})
}
func (s *staticModelManager) ListModel(_ context.Context, req *modelmgr.ListModelRequest) (*modelmgr.ListModelResponse, error) {
startIdx := 0
if req.Cursor != nil {