feat: add rag by codex

This commit is contained in:
2026-11-27 20:46:29 +03:30
parent 302d06b44f
commit 8a1e61b0f7
52 changed files with 3772 additions and 59 deletions
@@ -0,0 +1,61 @@
import {
Check,
Column,
CreateDateColumn,
Entity,
Index,
PrimaryColumn,
UpdateDateColumn,
} from 'typeorm';
export type ArticleStatus = 'pending' | 'processing' | 'ready' | 'failed';
@Entity('rag_article')
@Index('rag_article_dispatch_idx', ['status', 'createdAt', 'id'])
@Check(
'rag_article_status_check',
`"status" IN ('pending', 'processing', 'ready', 'failed')`,
)
export class Article {
@PrimaryColumn('uuid', { primaryKeyConstraintName: 'rag_article_pkey' })
id: string;
@Column('uuid')
storageKey: string;
@Column('uuid', { nullable: true })
runToken: string | null;
@Column({ length: 240 })
title: string;
@Column({ length: 255 })
fileName: string;
@Column({ length: 120 })
mimeType: string;
@Column('integer')
byteSize: number;
@Column('varchar', { length: 2048, nullable: true })
sourceUrl: string | null;
@Column('varchar', { length: 16 })
status: ArticleStatus;
@Column('integer', { default: 1 })
generation: number;
@Column('varchar', { length: 300, nullable: true })
embeddingModel: string | null;
@Column('varchar', { length: 80, nullable: true })
errorCode: string | null;
@CreateDateColumn({ type: 'timestamptz' })
createdAt: Date;
@UpdateDateColumn({ type: 'timestamptz' })
updatedAt: Date;
}