Skip to content

Commit 2400382

Browse files
committed
fix unit tests
1 parent 73047ec commit 2400382

File tree

3 files changed

+26
-16
lines changed

3 files changed

+26
-16
lines changed

backend/src/__tests__/xml-stream-parser.test.ts

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ describe('processStreamWithTags', () => {
4242
for await (const chunk of processStreamWithTags(
4343
stream,
4444
processors,
45-
onError
45+
onError,
46+
() => {}
4647
)) {
4748
result.push(chunk)
4849
}
@@ -92,7 +93,8 @@ describe('processStreamWithTags', () => {
9293
for await (const chunk of processStreamWithTags(
9394
stream,
9495
processors,
95-
onError
96+
onError,
97+
() => {}
9698
)) {
9799
result.push(chunk)
98100
}
@@ -151,7 +153,8 @@ describe('processStreamWithTags', () => {
151153
for await (const chunk of processStreamWithTags(
152154
stream,
153155
processors,
154-
onError
156+
onError,
157+
() => {}
155158
)) {
156159
result.push(chunk)
157160
}
@@ -209,7 +212,8 @@ describe('processStreamWithTags', () => {
209212
for await (const chunk of processStreamWithTags(
210213
stream,
211214
processors,
212-
onError
215+
onError,
216+
() => {}
213217
)) {
214218
result.push(chunk)
215219
}
@@ -252,7 +256,8 @@ describe('processStreamWithTags', () => {
252256
for await (const chunk of processStreamWithTags(
253257
stream,
254258
processors,
255-
onError
259+
onError,
260+
() => {}
256261
)) {
257262
result.push(chunk)
258263
}
@@ -300,7 +305,8 @@ describe('processStreamWithTags', () => {
300305
for await (const chunk of processStreamWithTags(
301306
stream,
302307
processors,
303-
onError
308+
onError,
309+
() => {}
304310
)) {
305311
result.push(chunk)
306312
}
@@ -355,7 +361,8 @@ describe('processStreamWithTags', () => {
355361
for await (const chunk of processStreamWithTags(
356362
stream,
357363
processors,
358-
onError
364+
onError,
365+
() => {}
359366
)) {
360367
result.push(chunk)
361368
}
@@ -404,7 +411,8 @@ describe('processStreamWithTags', () => {
404411
for await (const chunk of processStreamWithTags(
405412
stream,
406413
processors,
407-
onError
414+
onError,
415+
() => {}
408416
)) {
409417
result.push(chunk)
410418
}
@@ -443,7 +451,8 @@ describe('processStreamWithTags', () => {
443451
for await (const chunk of processStreamWithTags(
444452
stream,
445453
processors,
446-
onError
454+
onError,
455+
() => {}
447456
)) {
448457
result.push(chunk)
449458
}
@@ -468,7 +477,8 @@ describe('processStreamWithTags', () => {
468477
for await (const chunk of processStreamWithTags(
469478
stream,
470479
processors,
471-
onError
480+
onError,
481+
() => {}
472482
)) {
473483
result.push(chunk)
474484
}
@@ -505,7 +515,8 @@ describe('processStreamWithTags', () => {
505515
for await (const chunk of processStreamWithTags(
506516
stream,
507517
processors,
508-
onError
518+
onError,
519+
() => {}
509520
)) {
510521
result.push(chunk)
511522
}
@@ -561,7 +572,8 @@ describe('processStreamWithTags', () => {
561572
for await (const chunk of processStreamWithTags(
562573
stream,
563574
processors,
564-
onError
575+
onError,
576+
() => {}
565577
)) {
566578
result.push(chunk)
567579
}

backend/src/run-programmatic-step.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
import { getToolCallString } from '@codebuff/common/constants/tools'
12
import { PrintModeObject } from '@codebuff/common/types/print-mode'
23
import {
34
AgentState,
45
AgentTemplateType,
56
ToolResult,
67
} from '@codebuff/common/types/session-state'
78
import { ProjectFileContext } from '@codebuff/common/util/file'
8-
import { getToolCallString } from '@codebuff/common/constants/tools'
99
import { WebSocket } from 'ws'
1010
import { AgentTemplate, StepGenerator } from './templates/types'
1111
import { CodebuffToolCall } from './tools/constants'
@@ -49,8 +49,6 @@ export async function runProgrammaticStep(
4949
onResponseChunk,
5050
agentType,
5151
fileContext,
52-
assistantMessage,
53-
assistantPrefix,
5452
ws,
5553
}: {
5654
template: AgentTemplate

backend/src/xml-stream-parser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export async function* processStreamWithTags(
133133

134134
if (chunk === undefined) {
135135
streamCompleted = true
136-
if (buffer) {
136+
if (buffer.includes(startToolTag)) {
137137
buffer += completionSuffix
138138
chunk = completionSuffix
139139
autocompleted = true

0 commit comments

Comments
 (0)