Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(agent): page and seed correctly (#14048)

Nimare0d6be2a2b3d
diff --git a/packages/shared/scripts/seeder/utils/in-app-agent-seed.ts b/packages/shared/scripts/seeder/utils/in-app-agent-seed.ts
index af13e9faf7..46cca82940 100644
--- a/packages/shared/scripts/seeder/utils/in-app-agent-seed.ts
+++ b/packages/shared/scripts/seeder/utils/in-app-agent-seed.ts
@@ -140,6 +140,15 @@ export async function seedInAppAgentDemoConversation({
event: Prisma.InputJsonValue;
createdAt: Date;
}> = [];
+ const eventCountByRunId = new Map<string, number>();
+ const getEventCreatedAt = (runId: string) => {
+ const eventCount = eventCountByRunId.get(runId) ?? 0;
+ eventCountByRunId.set(runId, eventCount + 1);
+
+ const runCreatedAt =
+ runId === secondRunId ? secondRunCreatedAt : firstRunCreatedAt;
+ return new Date(runCreatedAt.getTime() + eventCount * 1000);
+ };
const addEvent = (
runId: string,
type: string,
@@ -153,7 +162,7 @@ export async function seedInAppAgentDemoConversation({
sequenceNumber,
type,
event: event as Prisma.InputJsonValue,
- createdAt: new Date(firstRunFinishedAt.getTime() + sequenceNumber * 1000),
+ createdAt: getEventCreatedAt(runId),
});
};
diff --git a/web/src/features/in-app-agent/components/InAppAgentDrawer.tsx b/web/src/features/in-app-agent/components/InAppAgentDrawer.tsx
index e676418b59..b237eb0d90 100644
--- a/web/src/features/in-app-agent/components/InAppAgentDrawer.tsx
+++ b/web/src/features/in-app-agent/components/InAppAgentDrawer.tsx
@@ -133,6 +133,7 @@ export function InAppAgentDrawer(props: InAppAgentDrawerProps) {
}
if (value === LOAD_MORE_CONVERSATIONS_VALUE) {
+ onLoadMoreConversations();
return;
}
@@ -162,10 +163,6 @@ export function InAppAgentDrawer(props: InAppAgentDrawerProps) {
value={LOAD_MORE_CONVERSATIONS_VALUE}
className="h-8"
disabled={isLoadingMoreConversations}
- onSelect={(event) => {
- event.preventDefault();
- onLoadMoreConversations();
- }}
>
{isLoadingMoreConversations ? "Loading..." : "Load more"}
</SelectItem>
diff --git a/web/src/features/in-app-agent/server/handler.ts b/web/src/features/in-app-agent/server/handler.ts
index 903cdd4d10..f019bfc560 100644
--- a/web/src/features/in-app-agent/server/handler.ts
+++ b/web/src/features/in-app-agent/server/handler.ts
@@ -261,8 +261,7 @@ export default async function handler(request: Request) {
return replacePersistedRunEvents();
},
- onComplete: () =>
- replacePersistedRunEvents().then(() => finishCurrentRun()),
+ onComplete: finishCurrentRun,
onAbort: () =>
finishCurrentRun({
errorCode: "cancelled",