Skip to content

Commit

Permalink
bugfix multiple generations
Browse files Browse the repository at this point in the history
  • Loading branch information
haouarihk committed Mar 9, 2024
1 parent 6d904c9 commit 4ec4f4d
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/LLMProviders/custom/base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,14 @@ export default class CustomProvider

console.log(rs);

return rs
?.map((c: Message) =>
c.type == "image_url" ? `![${c.image_url}]` : c.content
)
.join("\n");
return rs?.map((c: Message) =>
c.type == "image_url"
? {
...c,
content: `![${c.image_url}]\n${c.content}`,
}
: c
);
}
}

Expand Down Expand Up @@ -334,7 +337,7 @@ export default class CustomProvider
},
});

if (handlebarData.stream) resultContent = res as string;
if (typeof res != "object") resultContent = res as string;
else {
const choices = res as any;
resultContent =
Expand Down Expand Up @@ -415,7 +418,7 @@ export default class CustomProvider

if (!handlebarData.stream) {
s(choices);
}
} else r("streaming with multiple choices is not implemented");
} catch (errorRequest: any) {
logger("generateMultiple error", errorRequest);
return r(errorRequest);
Expand Down

0 comments on commit 4ec4f4d

Please sign in to comment.