mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-27 10:52:40 +08:00
chore: cleanup logs
This commit is contained in:
@@ -580,7 +580,6 @@ export class CopilotSessionModel extends BaseModel {
|
|||||||
.reduce((prev, cost) => prev + cost, 0);
|
.reduce((prev, cost) => prev + cost, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional()
|
|
||||||
async cleanupEmptySessions(earlyThen: Date) {
|
async cleanupEmptySessions(earlyThen: Date) {
|
||||||
// delete never used sessions
|
// delete never used sessions
|
||||||
const { count: removed } = await this.db.aiSession.deleteMany({
|
const { count: removed } = await this.db.aiSession.deleteMany({
|
||||||
|
|||||||
@@ -185,7 +185,6 @@ export class CopilotWorkspaceConfigModel extends BaseModel {
|
|||||||
return { workspaceId, AND: condition };
|
return { workspaceId, AND: condition };
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional()
|
|
||||||
async listEmbeddableDocIds(workspaceId: string) {
|
async listEmbeddableDocIds(workspaceId: string) {
|
||||||
const condition = this.getEmbeddableCondition(workspaceId);
|
const condition = this.getEmbeddableCondition(workspaceId);
|
||||||
const rows = await this.db.snapshot.findMany({
|
const rows = await this.db.snapshot.findMany({
|
||||||
|
|||||||
@@ -416,12 +416,12 @@ export class CopilotEmbeddingJob {
|
|||||||
workspaceId,
|
workspaceId,
|
||||||
docId
|
docId
|
||||||
);
|
);
|
||||||
this.logger.log(
|
this.logger.debug(
|
||||||
`Check if doc ${docId} in workspace ${workspaceId} needs embedding: ${needEmbedding}`
|
`Check if doc ${docId} in workspace ${workspaceId} needs embedding: ${needEmbedding}`
|
||||||
);
|
);
|
||||||
if (needEmbedding) {
|
if (needEmbedding) {
|
||||||
if (signal.aborted) {
|
if (signal.aborted) {
|
||||||
this.logger.log(
|
this.logger.debug(
|
||||||
`Doc ${docId} in workspace ${workspaceId} is aborted, skipping embedding.`
|
`Doc ${docId} in workspace ${workspaceId} is aborted, skipping embedding.`
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
@@ -442,7 +442,7 @@ export class CopilotEmbeddingJob {
|
|||||||
existsContent &&
|
existsContent &&
|
||||||
this.normalize(existsContent) === this.normalize(fragment.summary)
|
this.normalize(existsContent) === this.normalize(fragment.summary)
|
||||||
) {
|
) {
|
||||||
this.logger.log(
|
this.logger.debug(
|
||||||
`Doc ${docId} in workspace ${workspaceId} has no content change, skipping embedding.`
|
`Doc ${docId} in workspace ${workspaceId} has no content change, skipping embedding.`
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
@@ -464,12 +464,12 @@ export class CopilotEmbeddingJob {
|
|||||||
chunks
|
chunks
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
this.logger.log(
|
this.logger.debug(
|
||||||
`Doc ${docId} in workspace ${workspaceId} has summary, embedding done.`
|
`Doc ${docId} in workspace ${workspaceId} has summary, embedding done.`
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// for empty doc, insert empty embedding
|
// for empty doc, insert empty embedding
|
||||||
this.logger.warn(
|
this.logger.debug(
|
||||||
`Doc ${docId} in workspace ${workspaceId} has no summary, fulfilling empty embedding.`
|
`Doc ${docId} in workspace ${workspaceId} has no summary, fulfilling empty embedding.`
|
||||||
);
|
);
|
||||||
await this.models.copilotContext.fulfillEmptyEmbedding(
|
await this.models.copilotContext.fulfillEmptyEmbedding(
|
||||||
@@ -478,7 +478,7 @@ export class CopilotEmbeddingJob {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.logger.warn(
|
this.logger.debug(
|
||||||
`Doc ${docId} in workspace ${workspaceId} has no fragment, fulfilling empty embedding.`
|
`Doc ${docId} in workspace ${workspaceId} has no fragment, fulfilling empty embedding.`
|
||||||
);
|
);
|
||||||
await this.models.copilotContext.fulfillEmptyEmbedding(
|
await this.models.copilotContext.fulfillEmptyEmbedding(
|
||||||
@@ -498,7 +498,7 @@ export class CopilotEmbeddingJob {
|
|||||||
error instanceof CopilotContextFileNotSupported &&
|
error instanceof CopilotContextFileNotSupported &&
|
||||||
error.message.includes('no content found')
|
error.message.includes('no content found')
|
||||||
) {
|
) {
|
||||||
this.logger.warn(
|
this.logger.debug(
|
||||||
`Doc ${docId} in workspace ${workspaceId} has no content, fulfilling empty embedding.`
|
`Doc ${docId} in workspace ${workspaceId} has no content, fulfilling empty embedding.`
|
||||||
);
|
);
|
||||||
// if the doc is empty, we still need to fulfill the embedding
|
// if the doc is empty, we still need to fulfill the embedding
|
||||||
|
|||||||
Reference in New Issue
Block a user