Added image inputs; Version 1.0.0
This commit is contained in:
parent
a5d6163ef9
commit
a8e1a83e63
5 changed files with 54 additions and 9 deletions
|
|
@ -20,15 +20,31 @@ const getTextGemini = async (
|
|||
instructions: IAIInstructions,
|
||||
input: string,
|
||||
oldInput?: string,
|
||||
inputImage?: Buffer<ArrayBuffer>,
|
||||
): Promise<AIResponseText> => {
|
||||
const inputContent: Content = {
|
||||
role: "user",
|
||||
parts: [
|
||||
{
|
||||
text: input,
|
||||
},
|
||||
],
|
||||
};
|
||||
const inputContent: Content = inputImage
|
||||
? {
|
||||
role: "user",
|
||||
parts: [
|
||||
{
|
||||
text: input,
|
||||
},
|
||||
{
|
||||
inlineData: {
|
||||
mimeType: "image/png",
|
||||
data: Buffer.from(inputImage).toString("base64"),
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
: {
|
||||
role: "user",
|
||||
parts: [
|
||||
{
|
||||
text: input,
|
||||
},
|
||||
],
|
||||
};
|
||||
const oldInputContent: Content = {
|
||||
role: "user",
|
||||
parts: [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue