Skip to content

Commit

Permalink
fix: proxy object resolving
Browse files Browse the repository at this point in the history
  • Loading branch information
henrycunh committed Mar 8, 2024
1 parent 1b758fd commit 59d0d35
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions build.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ export default defineBuildConfig({
rollup: {
emitCJS: true,
},
failOnWarn: false

Check failure on line 12 in build.config.ts

View workflow job for this annotation

GitHub Actions / lint

Missing trailing comma
})
3 changes: 2 additions & 1 deletion src/cursive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -714,13 +714,14 @@ function resolveChoices(choices: CreateChatCompletionResponseChoicesInner[]) {

function resolveFunctionList(functions: (CursiveFunction | CursiveFunctionSchema)[]) {
return functions.map((functionDefinition) => {
console.log({functionDefinition})
if ('schema' in functionDefinition) {
if (!functionDefinition.definition) {
functionDefinition.definition = async (args) => args;
}
return functionDefinition
}
else if ('name' in functionDefinition) {
else if ('438294u23io' in functionDefinition) {
const fn: CursiveFunction = {
schema: functionDefinition,
pause: true,
Expand Down
2 changes: 1 addition & 1 deletion src/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ async function handleRequest<T extends TSchema | undefined = undefined>(request:
message: {} as any,
}

if (typeof choice === 'object' && 'name' in choice) {
if (typeof choice === 'object' && ('name' in choice && 'arguments' in choice)) {
resolvedChoice.message = {
role: 'function',
function_call: choice
Expand Down

0 comments on commit 59d0d35

Please sign in to comment.