fix: replace workflow hardcoding chat model for knowledge recall (#233)

This commit is contained in:
N3ko
2025-07-30 14:27:01 +08:00
committed by GitHub
parent 5013a9ed53
commit b9d03b148c
12 changed files with 218 additions and 123 deletions

View File

@@ -102,7 +102,7 @@ func TestQuestionAnswer(t *testing.T) {
mockTos := storageMock.NewMockStorage(ctrl)
mockTos.EXPECT().GetObjectUrl(gomock.Any(), gomock.Any(), gomock.Any()).Return("", nil).AnyTimes()
repo := repo2.NewRepository(mockIDGen, db, redisClient, mockTos,
checkpoint.NewRedisStore(redisClient))
checkpoint.NewRedisStore(redisClient), nil)
mockey.Mock(workflow.GetRepository).Return(repo).Build()
t.Run("answer directly, no structured output", func(t *testing.T) {

View File

@@ -223,9 +223,9 @@ func (s *NodeSchema) ToLLMConfig(ctx context.Context) (*llm.Config, error) {
}
if fcParams.KnowledgeFCParam != nil && len(fcParams.KnowledgeFCParam.KnowledgeList) > 0 {
kwChatModel, err := knowledgeRecallChatModel(ctx)
if err != nil {
return nil, err
kwChatModel := workflow2.GetRepository().GetKnowledgeRecallChatModel()
if kwChatModel == nil {
return nil, fmt.Errorf("workflow builtin chat model for knowledge recall not configured")
}
knowledgeOperator := crossknowledge.GetKnowledgeOperator()
setting := fcParams.KnowledgeFCParam.GlobalSetting
@@ -650,15 +650,3 @@ func totRetrievalSearchType(s int64) (crossknowledge.SearchType, error) {
return "", fmt.Errorf("invalid retrieval search type %v", s)
}
}
// knowledgeRecallChatModel the chat model used by the knowledge base recall in the LLM node, not the user-configured model
func knowledgeRecallChatModel(ctx context.Context) (einomodel.BaseChatModel, error) {
defaultChatModelParma := &model.LLMParams{
ModelName: "豆包·1.5·Pro·32k",
ModelType: 1,
Temperature: ptr.Of(0.5),
MaxTokens: 4096,
}
m, _, err := model.GetManager().GetModel(ctx, defaultChatModelParma)
return m, err
}