Skip to content

Commit 87c2445

Browse files
authored
Fix evaluations in the playground not working for agents (#1014)
1 parent f81ddcf commit 87c2445

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

apps/web/src/hooks/playgroundChat/usePlaygroundChat.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
import { StreamEventTypes } from '@latitude-data/core/browser'
2-
import { LanguageModelUsage } from 'ai'
3-
import { useCallback, useRef, useState } from 'react'
41
import {
52
ContentType,
6-
MessageRole,
7-
ToolMessage,
83
Message,
4+
MessageRole,
95
ToolCall,
6+
ToolMessage,
107
} from '@latitude-data/compiler'
118
import {
129
AGENT_RETURN_TOOL_NAME,
@@ -15,7 +12,10 @@ import {
1512
LatitudeChainCompletedEventData,
1613
LatitudeEventData,
1714
} from '@latitude-data/constants'
15+
import { StreamEventTypes } from '@latitude-data/core/browser'
16+
import { LanguageModelUsage } from 'ai'
1817
import { ParsedEvent } from 'eventsource-parser/stream'
18+
import { useCallback, useRef, useState } from 'react'
1919

2020
function buildMessage({ input }: { input: string | ToolMessage[] }) {
2121
if (typeof input === 'string') {
@@ -134,10 +134,6 @@ export function usePlaygroundChat({
134134
setChainLength(data.messages.length)
135135
setTime((prev) => (prev ?? 0) + (performance.now() - start))
136136
}
137-
138-
if (onPromptRan) {
139-
onPromptRan(documentLogUuid)
140-
}
141137
}
142138
if (data.type === ChainEventTypes.ToolsRequested) {
143139
setUnresponedToolCalls(
@@ -152,6 +148,7 @@ export function usePlaygroundChat({
152148

153149
setStreamingResponse(undefined)
154150
setIsLoading(false)
151+
onPromptRan?.(documentLogUuid)
155152
},
156153
[],
157154
)

0 commit comments

Comments
 (0)