fix(server): handle edge case of empty docs (#12608)

fix AI-130
This commit is contained in:
darkskygit
2025-05-28 11:25:53 +00:00
parent 9f0d4536c7
commit acf92aa3da
2 changed files with 4 additions and 2 deletions

View File

@@ -261,7 +261,7 @@ export class CopilotContextDocJob {
): Promise<DocFragment | null> { ): Promise<DocFragment | null> {
const docContent = await this.doc.getFullDocContent(workspaceId, docId); const docContent = await this.doc.getFullDocContent(workspaceId, docId);
const authors = await this.models.doc.getAuthors(workspaceId, docId); const authors = await this.models.doc.getAuthors(workspaceId, docId);
if (docContent?.summary && authors) { if (docContent && authors) {
const { title = 'Untitled', summary } = docContent; const { title = 'Untitled', summary } = docContent;
const { createdAt, updatedAt, createdByUser, updatedByUser } = authors; const { createdAt, updatedAt, createdByUser, updatedByUser } = authors;
return { return {

View File

@@ -28,7 +28,9 @@ test.describe('AIBasic/Chat', () => {
await check.hover(); await check.hover();
const tooltip = await page.getByTestId('ai-chat-embedding-status-tooltip'); const tooltip = await page.getByTestId('ai-chat-embedding-status-tooltip');
await expect(tooltip).toBeVisible(); await expect(tooltip).toBeVisible();
await expect(tooltip).toHaveText(/Results will improve after embedding/i); await expect(tooltip).toHaveText(
/Results will improve after embedding|Embedding finished/
);
}); });
test(`should send message and receive AI response: test(`should send message and receive AI response: