kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
fix: JSON utils unit tests
rodzic
4a2560432f
commit
cb63718743
|
@ -1,3 +1,4 @@
|
|||
import * as types from '@/types'
|
||||
import { Agentic } from '@/agentic'
|
||||
import { BaseTask } from '@/task'
|
||||
|
||||
|
@ -257,7 +258,11 @@ export abstract class HumanFeedbackMechanism<
|
|||
}
|
||||
}
|
||||
|
||||
export function withHumanFeedback<TInput, TOutput, V extends HumanFeedbackType>(
|
||||
export function withHumanFeedback<
|
||||
TInput extends void | types.JsonObject,
|
||||
TOutput extends types.JsonObject,
|
||||
V extends HumanFeedbackType
|
||||
>(
|
||||
task: BaseTask<TInput, TOutput>,
|
||||
options: HumanFeedbackOptions<V, TOutput> = {}
|
||||
) {
|
||||
|
|
|
@ -4,7 +4,6 @@ import { ZodType } from 'zod'
|
|||
import * as errors from './errors'
|
||||
import * as types from './types'
|
||||
import type { Agentic } from './agentic'
|
||||
import { defaultLogger } from './logger'
|
||||
import { defaultIDGeneratorFn, isValidTaskIdentifier } from './utils'
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,7 +9,7 @@ import * as types from './types'
|
|||
* @returns extracted JSON object string, or `undefined` if no JSON object is found
|
||||
*/
|
||||
export function extractJSONObjectFromString(text: string): string | undefined {
|
||||
return text.match(/\{(.|\n)*\}/gm)?.[0]
|
||||
return text.match(/\{([^}]|\n)*\}/gm)?.[0]
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -19,7 +19,7 @@ export function extractJSONObjectFromString(text: string): string | undefined {
|
|||
* @returns extracted JSON array string, or `undefined` if no JSON array is found
|
||||
*/
|
||||
export function extractJSONArrayFromString(text: string): string | undefined {
|
||||
return text.match(/\[(.|\n)*\]/gm)?.[0]
|
||||
return text.match(/\[([^\]]|\n)*\]/gm)?.[0]
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Ładowanie…
Reference in New Issue