-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from xyTom/support-different-prompt-for-differe…
…nt-models 支持模型选择和提示选择
- Loading branch information
Showing
9 changed files
with
239 additions
and
508 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import AzureOpenAI from 'openai'; | ||
async function GPT(image:string, prompt:string, APIKey:string, baseURL:string): Promise<string> { | ||
const openai = new AzureOpenAI({ apiKey: APIKey, baseURL: baseURL }); | ||
const response = await openai.chat.completions.create({ | ||
model: "gpt-4-vision-preview", | ||
messages: [ | ||
{ | ||
role: "user", | ||
content: [ | ||
{ type: "text", text: prompt }, | ||
{ | ||
type: "image_url", | ||
image_url: { | ||
"url": image, | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
}); | ||
console.log(response.choices[0]); | ||
return response.choices[0].toString(); | ||
} | ||
export default GPT; |
Oops, something went wrong.