Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

3.5 KB
Raw Blame
//
//  Copyright 2026 The InfiniFlow Authors. All Rights Reserved.
//
//  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 entity

import "time"

// DatasetLogDocumentID is the synthetic document identity shared by
// dataset-level graph, RAPTOR, mind-map, and knowledge-compilation logs.
const DatasetLogDocumentID = "graph_raptor_x"

// PipelineOperationLog pipeline operation log model
type PipelineOperationLog struct {
	ID         string `gorm:"column:id;primaryKey;size:32" json:"id"`
	DocumentID string `gorm:"column:document_id;size:32;index;uniqueIndex:idx_pipeline_operation_log_document_run,priority:1" json:"document_id"`
	// RunCount is the monotonically allocated display number for a numbered
	// ingestion run.
	RunCount          *int       `gorm:"column:run_count;uniqueIndex:idx_pipeline_operation_log_document_run,priority:2" json:"run_count,omitempty"`
	TenantID          string     `gorm:"column:tenant_id;size:32;not null;index" json:"tenant_id"`
	KbID              string     `gorm:"column:kb_id;size:32;not null;index" json:"kb_id"`
	PipelineID        *string    `gorm:"column:pipeline_id;size:32;index" json:"pipeline_id,omitempty"`
	PipelineTitle     *string    `gorm:"column:pipeline_title;size:255;index" json:"pipeline_title,omitempty"`
	PipelineVersionID *string    `gorm:"column:pipeline_version_id;size:32" json:"pipeline_version_id,omitempty"`
	ParserID          string     `gorm:"column:parser_id;size:32;not null;index" json:"parser_id"`
	DocumentName      string     `gorm:"column:document_name;size:255;not null" json:"document_name"`
	DocumentSuffix    string     `gorm:"column:document_suffix;size:255;not null" json:"document_suffix"`
	DocumentType      string     `gorm:"column:document_type;size:255;not null" json:"document_type"`
	SourceFrom        string     `gorm:"column:source_from;size:255;not null" json:"source_from"`
	Progress          float64    `gorm:"column:progress;default:0;index" json:"progress"`
	ProgressMsg       *string    `gorm:"column:progress_msg;type:longtext" json:"progress_msg,omitempty"`
	ProcessBeginAt    *time.Time `gorm:"column:process_begin_at;index" json:"process_begin_at,omitempty"`
	// ProcessDuration is the persisted terminal run duration in seconds. The
	// authoritative end time is recovered as ProcessBeginAt + ProcessDuration when
	// needed, so no separate process_end_at column is required.
	ProcessDuration float64 `gorm:"column:process_duration;default:0" json:"process_duration"`
	DSL             JSONMap `gorm:"column:dsl;type:longtext" json:"dsl,omitempty"`
	TaskType        string  `gorm:"column:task_type;size:32;not null;default:''" json:"task_type"`
	OperationStatus string  `gorm:"column:operation_status;size:32;not null" json:"operation_status"`
	Avatar          *string `gorm:"column:avatar;type:longtext" json:"avatar,omitempty"`
	Status          *string `gorm:"column:status;size:1;index" json:"status,omitempty"`
	BaseModel
}

// TableName specify table name
func (PipelineOperationLog) TableName() string {
	return "pipeline_operation_log"
}