diff options
author | Joanne <zehan_ding@brown.edu> | 2025-05-12 20:58:01 -0400 |
---|---|---|
committer | Joanne <zehan_ding@brown.edu> | 2025-05-12 20:58:01 -0400 |
commit | cd93c88b8fee83a99342eac4dc60f7b4373fa843 (patch) | |
tree | b00d1f46c802752c90e54bb21be785a05e05195e /src/client/apis/gpt/GPT.ts | |
parent | 4997c3de20a381eac30224a7a550afa66174f07d (diff) | |
parent | 3a733aa0fd24517e83649824dec0fc8bcc0bde43 (diff) |
added tutorial tool, still need to integrate with metadatatool
Diffstat (limited to 'src/client/apis/gpt/GPT.ts')
-rw-r--r-- | src/client/apis/gpt/GPT.ts | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/client/apis/gpt/GPT.ts b/src/client/apis/gpt/GPT.ts index 29b6ab989..9cb47995c 100644 --- a/src/client/apis/gpt/GPT.ts +++ b/src/client/apis/gpt/GPT.ts @@ -1,5 +1,6 @@ import { ChatCompletionMessageParam, Image } from 'openai/resources'; import { openai } from './setup'; +import { imageUrlToBase64 } from '../../../ClientUtils'; export enum GPTDocCommand { AssignTags = 1, @@ -270,7 +271,6 @@ const gptImageLabel = async (src: string, prompt: string): Promise<string> => { ], }); if (response.choices[0].message.content) { - console.log(response.choices[0].message.content); return response.choices[0].message.content; } return 'Missing labels'; @@ -310,7 +310,9 @@ const gptHandwriting = async (src: string): Promise<string> => { } }; -const gptDescribeImage = async (image: string): Promise<string> => { +const gptDescribeImage = async (userPrompt: string, url: string): Promise<string> => { + if (userPrompt) return userPrompt; + const image = imageUrlToBase64(url); try { const response = await openai.chat.completions.create({ model: 'gpt-4o', |