mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-03-22 23:30:36 +08:00
#### PR Dependency Tree * **PR #14583** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added Gemini 3.1 Pro Preview support (text, image, audio) and new GPT‑5 variants as defaults; centralized persistent telemetry state for more reliable client identity. * **UX** * Improved model submenu placement in chat preferences. * More robust mindmap parsing, preview, regeneration and replace behavior. * **Chores** * Bumped AI SDK and related dependencies. * **Tests** * Expanded/updated tests and increased timeouts for flaky flows. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
88 lines
2.6 KiB
TypeScript
88 lines
2.6 KiB
TypeScript
import { expect } from '@playwright/test';
|
|
|
|
import { test } from '../base/base-test';
|
|
|
|
test.describe('AIAction/ExplainSelection', () => {
|
|
test.beforeEach(async ({ loggedInPage: page, utils }) => {
|
|
await utils.testUtils.setupTestEnvironment(page);
|
|
await utils.chatPanel.openChatPanel(page);
|
|
});
|
|
|
|
test('should support explaining the selected content', async ({
|
|
loggedInPage: page,
|
|
utils,
|
|
}) => {
|
|
const { explainSelection } = await utils.editor.askAIWithText(
|
|
page,
|
|
'LLM(AI)'
|
|
);
|
|
const { answer, responses } = await explainSelection();
|
|
await expect(answer).toHaveText(
|
|
/Large Language Model|LLM|artificial intelligence/i,
|
|
{ timeout: 20000 }
|
|
);
|
|
expect(responses).toEqual(new Set(['insert-below', 'replace-selection']));
|
|
});
|
|
|
|
test('should support explaining the selected text block in edgeless', async ({
|
|
loggedInPage: page,
|
|
utils,
|
|
}) => {
|
|
const { explainSelection } = await utils.editor.askAIWithEdgeless(
|
|
page,
|
|
async () => {
|
|
await utils.editor.createEdgelessText(page, 'LLM(AI)');
|
|
}
|
|
);
|
|
|
|
const { answer, responses } = await explainSelection();
|
|
await expect(answer).toHaveText(
|
|
/Large Language Model|LLM|artificial intelligence/i,
|
|
{ timeout: 20000 }
|
|
);
|
|
expect(responses).toEqual(new Set(['insert-below']));
|
|
});
|
|
|
|
test('should support explaining the selected note block in edgeless', async ({
|
|
loggedInPage: page,
|
|
utils,
|
|
}) => {
|
|
const { explainSelection } = await utils.editor.askAIWithEdgeless(
|
|
page,
|
|
async () => {
|
|
await utils.editor.createEdgelessNote(page, 'LLM(AI)');
|
|
}
|
|
);
|
|
|
|
const { answer, responses } = await explainSelection();
|
|
await expect(answer).toHaveText(
|
|
/Large Language Model|LLM|artificial intelligence/i,
|
|
{ timeout: 20000 }
|
|
);
|
|
expect(responses).toEqual(new Set(['insert-below']));
|
|
});
|
|
|
|
test.skip('should show chat history in chat panel', async ({
|
|
loggedInPage: page,
|
|
utils,
|
|
}) => {
|
|
const { explainSelection } = await utils.editor.askAIWithText(page, 'LLM');
|
|
const { answer } = await explainSelection();
|
|
const replace = answer.getByTestId('answer-replace');
|
|
await replace.click();
|
|
await utils.chatPanel.waitForHistory(page, [
|
|
{
|
|
role: 'action',
|
|
},
|
|
]);
|
|
const {
|
|
answer: panelAnswer,
|
|
prompt,
|
|
actionName,
|
|
} = await utils.chatPanel.getLatestAIActionMessage(page);
|
|
await expect(panelAnswer).toHaveText(/Large Language Model/);
|
|
await expect(prompt).toHaveText(/Analyze and explain the follow text/);
|
|
await expect(actionName).toHaveText(/Explain this/);
|
|
});
|
|
});
|