refactor(workflow): Move the knowledge component in the Workflow package into the common crossdomain package (#708)

This commit is contained in:
Ryo
2025-08-12 17:10:36 +08:00
committed by GitHub
parent 9ff065cebd
commit b38ab95623
27 changed files with 586 additions and 710 deletions

View File

@@ -23,6 +23,7 @@ import (
"github.com/coze-dev/coze-studio/backend/infra/contract/chatmodel"
"github.com/coze-dev/coze-studio/backend/infra/contract/document"
"github.com/coze-dev/coze-studio/backend/infra/contract/document/parser"
"github.com/coze-dev/coze-studio/backend/pkg/lang/ptr"
)
@@ -124,6 +125,7 @@ type RetrievalStrategy struct {
EnableQueryRewrite bool
EnableRerank bool
EnableNL2SQL bool
IsPersonalOnly bool
}
type SelectType int64
@@ -283,3 +285,69 @@ type CopyKnowledgeResponse struct {
type MoveKnowledgeToLibraryRequest struct {
KnowledgeID int64
}
type ParseMode string
const (
FastParseMode = "fast_mode"
AccurateParseMode = "accurate_mode"
)
type ChunkType string
const (
ChunkTypeDefault ChunkType = "default"
ChunkTypeCustom ChunkType = "custom"
ChunkTypeLeveled ChunkType = "leveled"
)
type ParsingStrategy struct {
ParseMode ParseMode
ExtractImage bool
ExtractTable bool
ImageOCR bool
}
type ChunkingStrategy struct {
ChunkType ChunkType
ChunkSize int64
Separator string
Overlap int64
}
type CreateDocumentRequest struct {
KnowledgeID int64
ParsingStrategy *ParsingStrategy
ChunkingStrategy *ChunkingStrategy
FileURL string
FileName string
FileExtension parser.FileExtension
}
type CreateDocumentResponse struct {
DocumentID int64
FileName string
FileURL string
}
type DeleteDocumentRequest struct {
DocumentID string
}
type DeleteDocumentResponse struct {
IsSuccess bool
}
type KnowledgeDetail struct {
ID int64 `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
IconURL string `json:"-"`
FormatType int64 `json:"-"`
}
type ListKnowledgeDetailRequest struct {
KnowledgeIDs []int64
}
type ListKnowledgeDetailResponse struct {
KnowledgeDetails []*KnowledgeDetail
}

View File

@@ -0,0 +1,24 @@
package model
type LLMParams struct {
ModelName string `json:"modelName"`
ModelType int64 `json:"modelType"`
Prompt string `json:"prompt"` // user prompt
Temperature *float64 `json:"temperature"`
FrequencyPenalty float64 `json:"frequencyPenalty"`
PresencePenalty float64 `json:"presencePenalty"`
MaxTokens int `json:"maxTokens"`
TopP *float64 `json:"topP"`
TopK *int `json:"topK"`
EnableChatHistory bool `json:"enableChatHistory"`
SystemPrompt string `json:"systemPrompt"`
ResponseFormat ResponseFormat `json:"responseFormat"`
}
type ResponseFormat int64
const (
ResponseFormatText ResponseFormat = 0
ResponseFormatMarkdown ResponseFormat = 1
ResponseFormatJSON ResponseFormat = 2
)