refactor(workflow): Move the knowledge component in the Workflow package into the common crossdomain package (#708)
This commit is contained in:
40
backend/crossdomain/contract/modelmgr/modelmgr.go
Normal file
40
backend/crossdomain/contract/modelmgr/modelmgr.go
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright 2025 coze-dev Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package modelmgr
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
eino "github.com/cloudwego/eino/components/model"
|
||||
model "github.com/coze-dev/coze-studio/backend/api/model/crossdomain/modelmgr"
|
||||
"github.com/coze-dev/coze-studio/backend/infra/contract/modelmgr"
|
||||
)
|
||||
|
||||
//go:generate mockgen -destination modelmock/model_mock.go --package mockmodel -source modelmgr.go
|
||||
type Manager interface {
|
||||
GetModel(ctx context.Context, params *model.LLMParams) (eino.BaseChatModel, *modelmgr.Model, error)
|
||||
}
|
||||
|
||||
var defaultSVC Manager
|
||||
|
||||
func DefaultSVC() Manager {
|
||||
return defaultSVC
|
||||
}
|
||||
|
||||
func SetDefaultSVC(svc Manager) {
|
||||
defaultSVC = svc
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: modelmgr.go
|
||||
//
|
||||
// Generated by this command:
|
||||
//
|
||||
// mockgen -destination modelmock/model_mock.go --package mockmodel -source modelmgr.go
|
||||
//
|
||||
|
||||
// Package mockmodel is a generated GoMock package.
|
||||
package mockmodel
|
||||
|
||||
import (
|
||||
context "context"
|
||||
reflect "reflect"
|
||||
|
||||
model "github.com/cloudwego/eino/components/model"
|
||||
model0 "github.com/coze-dev/coze-studio/backend/api/model/crossdomain/modelmgr"
|
||||
modelmgr "github.com/coze-dev/coze-studio/backend/infra/contract/modelmgr"
|
||||
gomock "go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
// MockManager is a mock of Manager interface.
|
||||
type MockManager struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockManagerMockRecorder
|
||||
isgomock struct{}
|
||||
}
|
||||
|
||||
// MockManagerMockRecorder is the mock recorder for MockManager.
|
||||
type MockManagerMockRecorder struct {
|
||||
mock *MockManager
|
||||
}
|
||||
|
||||
// NewMockManager creates a new mock instance.
|
||||
func NewMockManager(ctrl *gomock.Controller) *MockManager {
|
||||
mock := &MockManager{ctrl: ctrl}
|
||||
mock.recorder = &MockManagerMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockManager) EXPECT() *MockManagerMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// GetModel mocks base method.
|
||||
func (m *MockManager) GetModel(ctx context.Context, params *model0.LLMParams) (model.BaseChatModel, *modelmgr.Model, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetModel", ctx, params)
|
||||
ret0, _ := ret[0].(model.BaseChatModel)
|
||||
ret1, _ := ret[1].(*modelmgr.Model)
|
||||
ret2, _ := ret[2].(error)
|
||||
return ret0, ret1, ret2
|
||||
}
|
||||
|
||||
// GetModel indicates an expected call of GetModel.
|
||||
func (mr *MockManagerMockRecorder) GetModel(ctx, params any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetModel", reflect.TypeOf((*MockManager)(nil).GetModel), ctx, params)
|
||||
}
|
||||
Reference in New Issue
Block a user