mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-09-08 10:14:35 +08:00
Fix data models (#13444)
### What problem does this PR solve? Since database model is updated in python version, go server also need to update ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --------- Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
@@ -17,15 +17,18 @@
|
||||
package model
|
||||
|
||||
// EvaluationDataset evaluation dataset model
|
||||
// Note: Python defines custom create_time/update_time (not null) instead of using BaseModel's
|
||||
type EvaluationDataset struct {
|
||||
ID string `gorm:"column:id;primaryKey;size:32" json:"id"`
|
||||
TenantID string `gorm:"column:tenant_id;size:32;not null;index" json:"tenant_id"`
|
||||
Name string `gorm:"column:name;size:255;not null;index" json:"name"`
|
||||
ID string `gorm:"column:id;primaryKey;size:32" json:"id"`
|
||||
TenantID string `gorm:"column:tenant_id;size:32;not null;index" json:"tenant_id"`
|
||||
Name string `gorm:"column:name;size:255;not null;index" json:"name"`
|
||||
Description *string `gorm:"column:description;type:longtext" json:"description,omitempty"`
|
||||
KbIDs JSONMap `gorm:"column:kb_ids;type:json;not null" json:"kb_ids"`
|
||||
CreatedBy string `gorm:"column:created_by;size:32;not null;index" json:"created_by"`
|
||||
Status int64 `gorm:"column:status;default:1;index" json:"status"`
|
||||
BaseModel
|
||||
KbIDs JSONMap `gorm:"column:kb_ids;type:longtext;not null" json:"kb_ids"`
|
||||
CreatedBy string `gorm:"column:created_by;size:32;not null;index" json:"created_by"`
|
||||
// Custom time fields (not null) to match Python
|
||||
CreateTime int64 `gorm:"column:create_time;not null;index" json:"create_time"`
|
||||
UpdateTime int64 `gorm:"column:update_time;not null" json:"update_time"`
|
||||
Status int64 `gorm:"column:status;default:1;index" json:"status"`
|
||||
}
|
||||
|
||||
// TableName specify table name
|
||||
@@ -34,15 +37,17 @@ func (EvaluationDataset) TableName() string {
|
||||
}
|
||||
|
||||
// EvaluationCase evaluation case model
|
||||
// Note: Python defines custom create_time (not null) instead of using BaseModel's
|
||||
type EvaluationCase struct {
|
||||
ID string `gorm:"column:id;primaryKey;size:32" json:"id"`
|
||||
DatasetID string `gorm:"column:dataset_id;size:32;not null;index" json:"dataset_id"`
|
||||
Question string `gorm:"column:question;type:longtext;not null" json:"question"`
|
||||
ReferenceAnswer *string `gorm:"column:reference_answer;type:longtext" json:"reference_answer,omitempty"`
|
||||
RelevantDocIDs *JSONMap `gorm:"column:relevant_doc_ids;type:json" json:"relevant_doc_ids,omitempty"`
|
||||
RelevantChunkIDs *JSONMap `gorm:"column:relevant_chunk_ids;type:json" json:"relevant_chunk_ids,omitempty"`
|
||||
Metadata *JSONMap `gorm:"column:metadata;type:json" json:"metadata,omitempty"`
|
||||
BaseModel
|
||||
RelevantDocIDs *JSONMap `gorm:"column:relevant_doc_ids;type:longtext" json:"relevant_doc_ids,omitempty"`
|
||||
RelevantChunkIDs *JSONMap `gorm:"column:relevant_chunk_ids;type:longtext" json:"relevant_chunk_ids,omitempty"`
|
||||
Metadata *JSONMap `gorm:"column:metadata;type:longtext" json:"metadata,omitempty"`
|
||||
// Custom time field (not null) to match Python
|
||||
CreateTime int64 `gorm:"column:create_time;not null" json:"create_time"`
|
||||
}
|
||||
|
||||
// TableName specify table name
|
||||
@@ -51,16 +56,19 @@ func (EvaluationCase) TableName() string {
|
||||
}
|
||||
|
||||
// EvaluationRun evaluation run model
|
||||
// Note: Python defines custom create_time/complete_time instead of using BaseModel's
|
||||
type EvaluationRun struct {
|
||||
ID string `gorm:"column:id;primaryKey;size:32" json:"id"`
|
||||
DatasetID string `gorm:"column:dataset_id;size:32;not null;index" json:"dataset_id"`
|
||||
DialogID string `gorm:"column:dialog_id;size:32;not null;index" json:"dialog_id"`
|
||||
Name string `gorm:"column:name;size:255;not null" json:"name"`
|
||||
ConfigSnapshot JSONMap `gorm:"column:config_snapshot;type:json;not null" json:"config_snapshot"`
|
||||
MetricsSummary *JSONMap `gorm:"column:metrics_summary;type:json" json:"metrics_summary,omitempty"`
|
||||
ConfigSnapshot JSONMap `gorm:"column:config_snapshot;type:longtext;not null" json:"config_snapshot"`
|
||||
MetricsSummary *JSONMap `gorm:"column:metrics_summary;type:longtext" json:"metrics_summary,omitempty"`
|
||||
Status string `gorm:"column:status;size:32;not null;default:PENDING" json:"status"`
|
||||
CreatedBy string `gorm:"column:created_by;size:32;not null;index" json:"created_by"`
|
||||
BaseModel
|
||||
// Custom time fields to match Python
|
||||
CreateTime int64 `gorm:"column:create_time;not null;index" json:"create_time"`
|
||||
CompleteTime *int64 `gorm:"column:complete_time" json:"complete_time,omitempty"`
|
||||
}
|
||||
|
||||
// TableName specify table name
|
||||
@@ -69,16 +77,18 @@ func (EvaluationRun) TableName() string {
|
||||
}
|
||||
|
||||
// EvaluationResult evaluation result model
|
||||
// Note: Python defines custom create_time (not null) instead of using BaseModel's
|
||||
type EvaluationResult struct {
|
||||
ID string `gorm:"column:id;primaryKey;size:32" json:"id"`
|
||||
RunID string `gorm:"column:run_id;size:32;not null;index" json:"run_id"`
|
||||
CaseID string `gorm:"column:case_id;size:32;not null;index" json:"case_id"`
|
||||
GeneratedAnswer string `gorm:"column:generated_answer;type:longtext;not null" json:"generated_answer"`
|
||||
RetrievedChunks JSONMap `gorm:"column:retrieved_chunks;type:json;not null" json:"retrieved_chunks"`
|
||||
Metrics JSONMap `gorm:"column:metrics;type:json;not null" json:"metrics"`
|
||||
RetrievedChunks JSONMap `gorm:"column:retrieved_chunks;type:longtext;not null" json:"retrieved_chunks"`
|
||||
Metrics JSONMap `gorm:"column:metrics;type:longtext;not null" json:"metrics"`
|
||||
ExecutionTime float64 `gorm:"column:execution_time;not null" json:"execution_time"`
|
||||
TokenUsage *JSONMap `gorm:"column:token_usage;type:json" json:"token_usage,omitempty"`
|
||||
BaseModel
|
||||
TokenUsage *JSONMap `gorm:"column:token_usage;type:longtext" json:"token_usage,omitempty"`
|
||||
// Custom time field to match Python
|
||||
CreateTime int64 `gorm:"column:create_time;not null" json:"create_time"`
|
||||
}
|
||||
|
||||
// TableName specify table name
|
||||
|
||||
Reference in New Issue
Block a user