Skip to content

Commit

Permalink
Revert "Update openAI.ts"
Browse files Browse the repository at this point in the history
This reverts commit a51abd2.
  • Loading branch information
babaohuang committed Dec 17, 2023
1 parent fc42153 commit 288f703
Showing 1 changed file with 2 additions and 21 deletions.
23 changes: 2 additions & 21 deletions src/utils/openAI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,8 @@ const genAI = apiBaseUrl
? new GoogleGenerativeAI(apiKey, apiBaseUrl)
: new GoogleGenerativeAI(apiKey)

const safetySettings = [
{
category: HarmCategory.HARM_CATEGORY_HARASSMENT,
threshold: HarmBlockThreshold.BLOCK_NONE,
},
{
category: HarmCategory.HARM_CATEGORY_HATE_SPEECH,
threshold: HarmBlockThreshold.BLOCK_NONE,
},
{
category: HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT,
threshold: HarmBlockThreshold.BLOCK_NONE,
},
{
category: HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT,
threshold: HarmBlockThreshold.BLOCK_NONE,
},
]

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

const chat = model.startChat({
history: history.map(msg => ({
Expand All @@ -42,4 +23,4 @@ export const startChatAndSendMessageStream = async(history: ChatMessage[], newMe
// Use sendMessageStream for streaming responses
const result = await chat.sendMessageStream(newMessage)
return result.stream
}
}

Check failure on line 26 in src/utils/openAI.ts

View workflow job for this annotation

GitHub Actions / lint

Newline required at end of file but not found

1 comment on commit 288f703

@vercel
Copy link

@vercel vercel bot commented on 288f703 Dec 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.