Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions apps/dojo/e2e/featurePages/AgenticChatPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,22 @@ export class AgenticChatPage {
await expect(this.userMessage.getByText(text)).toBeVisible();
}

async assertAgentReplyVisible(expectedText: RegExp) {
const agentMessage = this.page.locator(".copilotKitAssistantMessage", {
hasText: expectedText,
});
await expect(agentMessage.last()).toBeVisible({ timeout: 10000 });
async assertAgentReplyVisible(expectedText: RegExp | RegExp[]) {
const expectedTexts = Array.isArray(expectedText) ? expectedText : [expectedText];
for (const expectedText1 of expectedTexts) {
try {
const agentMessage = this.page.locator(".copilotKitAssistantMessage", {
hasText: expectedText1
});
await expect(agentMessage.last()).toBeVisible({ timeout: 10000 });
} catch (error) {
console.log(`Did not work for ${expectedText1}`)
// Allow test to pass if at least one expectedText matches
if (expectedText1 === expectedTexts[expectedTexts.length - 1]) {
throw error;
}
}
}
}

async assertAgentReplyContains(expectedText: string) {
Expand Down
18 changes: 16 additions & 2 deletions apps/dojo/e2e/pages/pydanticAIPages/AgenticUIGenPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,22 @@ export class AgenticGenUIPage {
return this.page.getByRole('button', { name });
}

async assertAgentReplyVisible(expectedText: RegExp) {
await expect(this.agentMessage.last().getByText(expectedText)).toBeVisible();
async assertAgentReplyVisible(expectedText: RegExp | RegExp[]) {
const expectedTexts = Array.isArray(expectedText) ? expectedText : [expectedText];
for (const expectedText1 of expectedTexts) {
try {
const agentMessage = this.page.locator(".copilotKitAssistantMessage", {
hasText: expectedText1
});
await expect(agentMessage.last()).toBeVisible({ timeout: 10000 });
} catch (error) {
console.log(`Did not work for ${expectedText1}`)
// Allow test to pass if at least one expectedText matches
if (expectedText1 === expectedTexts[expectedTexts.length - 1]) {
throw error;
}
}
}
}

async getUserText(textOrRegex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ test("[LlamaIndex] Agentic Chat retains memory of user messages during a convers
await chat.sendMessage("Hey there");
await chat.assertUserMessageVisible("Hey there");
await waitForAIResponse(page);
await chat.assertAgentReplyVisible(/how can I assist you/i);
await chat.assertAgentReplyVisible([/assist you/i, /help you/i]);

const favFruit = "Mango";
await chat.sendMessage(`My favorite fruit is ${favFruit}`);
Expand Down
2 changes: 1 addition & 1 deletion apps/dojo/e2e/tests/pydanticAITests/agenticGenUI.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test.describe("Agent Generative UI Feature", () => {
await genUIAgent.openChat();
await genUIAgent.sendMessage("Hi");
await genUIAgent.sendButton.click();
await genUIAgent.assertAgentReplyVisible(/Hello/);
await genUIAgent.assertAgentReplyVisible([/Hello/, /Hi/]);

await genUIAgent.sendMessage("give me a plan to make brownies");
await genUIAgent.sendButton.click();
Expand Down
17 changes: 9 additions & 8 deletions apps/dojo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@
"@ag-ui/spring-ai": "workspace:*",
"@ag-ui/vercel-ai-sdk": "workspace:*",
"@ai-sdk/openai": "^2.0.42",
"@copilotkit/react-core": "1.10.6",
"@copilotkit/react-ui": "1.10.6",
"@copilotkit/runtime": "1.10.6",
"@copilotkit/runtime-client-gql": "1.10.6",
"@copilotkit/shared": "1.10.6",
"@copilotkitnext/react": "0.0.19-alpha.0",
"@copilotkitnext/runtime": "0.0.19-alpha.0",
"@copilotkitnext/agent": "0.0.19-alpha.0",
"@copilotkit/react-core": "0.0.0-feat-cpk-1-5-20251128151605",
"@copilotkit/react-ui": "0.0.0-feat-cpk-1-5-20251128151605",
"@copilotkit/runtime": "0.0.0-feat-cpk-1-5-20251128151605",
"@copilotkit/runtime-client-gql": "0.0.0-feat-cpk-1-5-20251128151605",
"@copilotkit/shared": "0.0.0-feat-cpk-1-5-20251128151605",
"@copilotkitnext/agent": "0.0.22",
"@copilotkitnext/core": "0.0.22",
"@copilotkitnext/react": "0.0.22",
"@copilotkitnext/runtime": "0.0.22",
"@mastra/client-js": "^0.15.2",
"@mastra/core": "^0.20.2",
"@mastra/dynamodb": "^0.15.6",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import "./style.css";
import {
CopilotKit,
useFrontendTool,
useHumanInTheLoop,
useCopilotReadable,
} from "@copilotkit/react-core";
import { CopilotChat } from "@copilotkit/react-ui";

Expand Down Expand Up @@ -32,6 +34,10 @@ const AgenticChat: React.FC<AgenticChatProps> = ({ params }) => {
const Chat = () => {
const [background, setBackground] = useState<string>("--copilot-kit-background-color");

useCopilotReadable({
description: 'Name of the user',
value: 'Bob'
})
useFrontendTool({
name: "change_background",
description:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,3 @@ export async function POST(request: NextRequest) {

return handleRequest(request);
}

32 changes: 16 additions & 16 deletions apps/dojo/src/files.json

Large diffs are not rendered by default.

Loading
Loading