Refine openai model syntax
This commit is contained in:
parent
3f29a4d0aa
commit
af2c840e0a
@ -9,6 +9,7 @@ import { cleanUpAiTextResponse } from '@/photo/ai';
|
|||||||
|
|
||||||
const RATE_LIMIT_IDENTIFIER = 'openai-image-query';
|
const RATE_LIMIT_IDENTIFIER = 'openai-image-query';
|
||||||
const RATE_LIMIT_MAX_QUERIES_PER_HOUR = 100;
|
const RATE_LIMIT_MAX_QUERIES_PER_HOUR = 100;
|
||||||
|
const MODEL = 'gpt-4o';
|
||||||
|
|
||||||
const openai = AI_TEXT_GENERATION_ENABLED
|
const openai = AI_TEXT_GENERATION_ENABLED
|
||||||
? createOpenAI({ apiKey: process.env.OPENAI_SECRET_KEY })
|
? createOpenAI({ apiKey: process.env.OPENAI_SECRET_KEY })
|
||||||
@ -45,7 +46,7 @@ const getImageTextArgs = (
|
|||||||
Parameters<typeof streamText>[0] &
|
Parameters<typeof streamText>[0] &
|
||||||
Parameters<typeof generateText>[0]
|
Parameters<typeof generateText>[0]
|
||||||
) | undefined => openai ? {
|
) | undefined => openai ? {
|
||||||
model: openai('gpt-4o'),
|
model: openai(MODEL),
|
||||||
messages: [{
|
messages: [{
|
||||||
'role': 'user',
|
'role': 'user',
|
||||||
'content': [
|
'content': [
|
||||||
@ -102,7 +103,7 @@ export const testOpenAiConnection = async () => {
|
|||||||
|
|
||||||
if (openai) {
|
if (openai) {
|
||||||
return generateText({
|
return generateText({
|
||||||
model: openai('gpt-4o'),
|
model: openai(MODEL),
|
||||||
messages: [{
|
messages: [{
|
||||||
'role': 'user',
|
'role': 'user',
|
||||||
'content': [
|
'content': [
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user