update trans

This commit is contained in:
duanfuxiang
2025-07-03 09:03:00 +08:00
parent 98bc810b86
commit a269258353
11 changed files with 2679 additions and 173 deletions

View File

@@ -207,6 +207,16 @@ export class InsightManager {
await this.repository.clearAllInsights(embeddingModel)
}
/**
* 删除指定ID的洞察
*/
async deleteInsightById(
id: number,
embeddingModel: EmbeddingModel,
): Promise<void> {
await this.repository.deleteInsightById(id, embeddingModel)
}
/**
* 文件删除时清理相关洞察
*/

View File

@@ -29,7 +29,8 @@ export class InsightRepository {
const tableName = this.getTableName(embeddingModel)
const result = await this.db.query<SelectSourceInsight>(
`SELECT * FROM "${tableName}" ORDER BY created_at DESC`
)
)
console.log(result.rows)
return result.rows
}
@@ -128,6 +129,20 @@ export class InsightRepository {
await this.db.query(`DELETE FROM "${tableName}"`)
}
async deleteInsightById(
id: number,
embeddingModel: EmbeddingModel,
): Promise<void> {
if (!this.db) {
throw new DatabaseNotInitializedException()
}
const tableName = this.getTableName(embeddingModel)
await this.db.query(
`DELETE FROM "${tableName}" WHERE id = $1`,
[id]
)
}
async insertInsights(
data: InsertSourceInsight[],
embeddingModel: EmbeddingModel,