Skip to content

Commit

Permalink
vite get enviroment variable
Browse files Browse the repository at this point in the history
  • Loading branch information
antergone authored Dec 18, 2023
1 parent f7a84d3 commit 45965c9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/utils/openAI.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { GoogleGenerativeAI } from '@fuyun/generative-ai'

const apiKey = process.env.GEMINI_API_KEY
const apiBaseUrl = process.env.API_BASE_URL?.trim().replace(/\/$/, '')
const apiKey = (import.meta.env.GEMINI_API_KEY)
const apiBaseUrl = (import.meta.env.API_BASE_URL)?.trim().replace(/\/$/, '')

const genAI = apiBaseUrl
? new GoogleGenerativeAI(apiKey, apiBaseUrl)
: new GoogleGenerativeAI(apiKey)
: new GoogleGenerativeAI(apiKey)

export const startChatAndSendMessageStream = async(history: ChatMessage[], newMessage: string) => {
const model = genAI.getGenerativeModel({ model: 'gemini-pro' })
Expand Down

0 comments on commit 45965c9

Please sign in to comment.