File tree Expand file tree Collapse file tree 5 files changed +8
-12
lines changed
Expand file tree Collapse file tree 5 files changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -83,9 +83,9 @@ export async function* processStreamWithTags(
8383 } ,
8484 )
8585 const shortenedContents =
86- contents . length < 50
86+ contents . length < 200
8787 ? contents
88- : contents . slice ( 0 , 20 ) + '...' + contents . slice ( - 20 )
88+ : contents . slice ( 0 , 100 ) + '...' + contents . slice ( - 100 )
8989 const errorMessage = `Invalid JSON: ${ JSON . stringify ( shortenedContents ) } \nError: ${ error . message } `
9090 onResponseChunk ( {
9191 type : 'error' ,
Original file line number Diff line number Diff line change 1- import { has , isEqual } from 'lodash'
1+ import { cloneDeep , has , isEqual } from 'lodash'
22
33import { buildArray } from './array'
4- import { deepCopy } from './object'
54import { getToolCallString } from '../tools/utils'
65
76import type {
@@ -23,7 +22,7 @@ export function toContentString(msg: ModelMessage): string {
2322export function withCacheControl <
2423 T extends { providerOptions ?: ProviderMetadata } ,
2524> ( obj : T ) : T {
26- const wrapper = deepCopy ( obj )
25+ const wrapper = cloneDeep ( obj )
2726 if ( ! wrapper . providerOptions ) {
2827 wrapper . providerOptions = { }
2928 }
@@ -41,7 +40,7 @@ export function withCacheControl<
4140export function withoutCacheControl <
4241 T extends { providerOptions ?: ProviderMetadata } ,
4342> ( obj : T ) : T {
44- const wrapper = deepCopy ( obj )
43+ const wrapper = cloneDeep ( obj )
4544 if ( has ( wrapper . providerOptions ?. anthropic ?. cacheControl , 'type' ) ) {
4645 delete wrapper . providerOptions ?. anthropic ?. cacheControl ?. type
4746 }
Original file line number Diff line number Diff line change @@ -129,7 +129,3 @@ export function errorToObject(value: any) {
129129 }
130130 return value
131131}
132-
133- export function deepCopy < T > ( obj : T ) : T {
134- return JSON . parse ( JSON . stringify ( obj ) ) as T
135- }
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import { promptAiSdkStructured } from '@codebuff/backend/llm-apis/vercel-ai-sdk/
77import { models } from '@codebuff/common/constants'
88import { withTimeout } from '@codebuff/common/util/promise'
99import { generateCompactId } from '@codebuff/common/util/string'
10+ import { cloneDeep } from 'lodash'
1011import pLimit from 'p-limit'
1112
1213import { resetRepoToCommit } from '../scaffolding'
@@ -487,7 +488,7 @@ export async function runGitEvals(
487488 `Completed eval for commit ${ testRepoName } - ${ evalCommit . spec . split ( '\n' ) [ 0 ] } ` ,
488489 )
489490 if ( ! logToStdout ) {
490- const finalResult = message . result
491+ const finalResult = cloneDeep ( message . result )
491492 for ( const cbTrace of finalResult . trace ) {
492493 delete ( cbTrace as any ) . steps
493494 }
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ export class CodebuffRunner implements Runner {
6262 prompt,
6363 handleEvent : ( event ) => {
6464 if ( event . type === 'error' ) {
65- throw new Error ( event . message )
65+ console . log ( '\n\n' + JSON . stringify ( event , null , 2 ) )
6666 }
6767 if ( event . type === 'text' ) {
6868 if ( toolResults . length > 0 ) {
You can’t perform that action at this time.
0 commit comments