mirror of
https://github.com/EthanMarti/infio-copilot.git
synced 2026-05-08 16:10:09 +00:00
update trans
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件删除时清理相关洞察
|
||||
*/
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user