chore: replace all cn comments to en version by volc api (#313)

This commit is contained in:
tecvan
2025-07-31 15:18:11 +08:00
committed by GitHub
parent 91d6cdb430
commit 5abc63fba6
254 changed files with 5899 additions and 5844 deletions

View File

@@ -48,7 +48,7 @@ type baseDocProcessor struct {
Documents []*entity.Document
documentSource *entity.DocumentSource
// 落DB 的 model
// Drop DB model
TableName string
docModels []*model.KnowledgeDocument
@@ -63,7 +63,7 @@ type baseDocProcessor struct {
}
func (p *baseDocProcessor) BeforeCreate() error {
// 从数据源拉取数据
// Pull data from a data source
return nil
}
@@ -154,7 +154,7 @@ func (p *baseDocProcessor) InsertDBModel() (err error) {
func (p *baseDocProcessor) createTable() error {
if len(p.Documents) == 1 && p.Documents[0].Type == knowledge.DocumentTypeTable {
// 表格型知识库,创建表
// Tabular knowledge base, creating tables
rdbColumns := []*rdbEntity.Column{}
tableColumns := p.Documents[0].TableInfo.Columns
columnIDs, err := p.idgen.GenMultiIDs(p.ctx, len(tableColumns)+1)
@@ -178,13 +178,13 @@ func (p *baseDocProcessor) createTable() error {
Indexing: false,
Sequence: -1,
})
// 为每个表格增加个主键ID
// Add a primary key ID to each table
rdbColumns = append(rdbColumns, &rdbEntity.Column{
Name: consts.RDBFieldID,
DataType: rdbEntity.TypeBigInt,
NotNull: true,
})
// 创建一个数据表
// Create a data table
resp, err := p.rdb.CreateTable(p.ctx, &rdb.CreateTableRequest{
Table: &rdbEntity.Table{
Columns: rdbColumns,

View File

@@ -18,7 +18,7 @@ package impl
import "github.com/coze-dev/coze-studio/backend/pkg/logs"
// 用户输入自定义内容后创建文档
// Create a document after the user enters custom content
type customDocProcessor struct {
baseDocProcessor
}

View File

@@ -24,7 +24,7 @@ import (
"github.com/coze-dev/coze-studio/backend/types/errno"
)
// 用户自定义表格创建文档
// User-defined form creation document
type customTableProcessor struct {
baseDocProcessor
}
@@ -46,7 +46,7 @@ func (c *customTableProcessor) BeforeCreate() error {
return errorx.New(errno.ErrKnowledgeTableInfoNotExistCode, errorx.KVf("msg", "table info not found, doc_id: %d", tableDoc[0].ID))
}
c.Documents[0].TableInfo = *tableDoc[0].TableInfo
// 追加场景
// append scene
if c.Documents[0].RawContent != "" {
c.Documents[0].FileExtension = getFormatType(c.Documents[0].Type)
uri := getTosUri(c.UserID, string(c.Documents[0].FileExtension))
@@ -65,14 +65,14 @@ func (c *customTableProcessor) BuildDBModel() error {
if len(c.Documents) > 0 &&
c.Documents[0].Type == knowledge.DocumentTypeTable {
if c.Documents[0].IsAppend {
// 追加场景,不需要创建表了
// 一是用户自定义一些数据、二是再上传一个表格,把表格里的数据追加到表格中
// Append the scene, no need to create a table
// First, the user customizes some data, and second, uploads another form and appends the data in the form to the form
} else {
err := c.baseDocProcessor.BuildDBModel()
if err != nil {
return err
}
// 因为这种创建方式不带数据,所以直接设置状态为可用
// Since this method of creation does not carry any data, the state is set to available directly
for i := range c.docModels {
c.docModels[i].DocumentType = 1
c.docModels[i].Status = int32(entity.DocumentStatusInit)
@@ -84,7 +84,7 @@ func (c *customTableProcessor) BuildDBModel() error {
func (c *customTableProcessor) InsertDBModel() error {
if isTableAppend(c.Documents) {
// 追加场景,设置文档为处理中状态
// Append the scene and set the document to the processing state
err := c.documentRepo.SetStatus(c.ctx, c.Documents[0].ID, int32(entity.DocumentStatusUploading), "")
if err != nil {
logs.CtxErrorf(c.ctx, "document set status err:%v", err)

View File

@@ -65,7 +65,7 @@ func (l *localTableProcessor) BuildDBModel() error {
func (l *localTableProcessor) InsertDBModel() error {
if isTableAppend(l.Documents) {
// 追加场景,设置文档为处理中状态
// Append the scene and set the document to the processing state
err := l.documentRepo.SetStatus(l.ctx, l.Documents[0].ID, int32(entity.DocumentStatusUploading), "")
if err != nil {
logs.CtxErrorf(l.ctx, "document set status err:%v", err)

View File

@@ -19,10 +19,10 @@ package processor
import "github.com/coze-dev/coze-studio/backend/domain/knowledge/entity"
type DocProcessor interface {
BeforeCreate() error // 获取数据源
BuildDBModel() error // 构建Doc记录
InsertDBModel() error // 向数据库中插入一条Doc记录
Indexing() error // 发起索引任务
GetResp() []*entity.Document // 返回处理后的文档信息
BeforeCreate() error // Get data source
BuildDBModel() error // Build Doc Record
InsertDBModel() error // Insert a Doc record into the database
Indexing() error // Initiate indexing task
GetResp() []*entity.Document // Return the processed document information
//GetColumnName()
}