Skip to content

Commit

Permalink
Revert "change sdk"
Browse files Browse the repository at this point in the history
This reverts commit 31e1dab.
  • Loading branch information
babaohuang committed Dec 17, 2023
1 parent 8a88633 commit 5fbfb89
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ GEMINI_API_KEY=
# Provide proxy for OpenAI API. e.g. http://127.0.0.1:7890
HTTPS_PROXY=
# Custom base url for OpenAI API. default: https://api.openai.com
API_BASE_URL=
OPENAI_API_BASE_URL=
# Inject analytics or other scripts before </head> of the page
HEAD_SCRIPTS=
# Secret string for the project. Use for generating signatures for API calls
Expand Down
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@astrojs/node": "^5.3.0",
"@astrojs/solid-js": "^2.2.0",
"@astrojs/vercel": "^3.5.0",
"@fuyun/generative-ai": "^0.1.2",
"@google/generative-ai": "^0.1.1",
"@zag-js/slider": "^0.16.0",
"@zag-js/solid": "^0.16.0",
"astro": "^2.7.0",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions src/utils/openAI.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import { GoogleGenerativeAI } from '@fuyun/generative-ai'
import { GoogleGenerativeAI } from '@google/generative-ai'

const apiKey = process.env.GEMINI_API_KEY
const apiBaseUrl = process.env.API_BASE_URL

// 根据是否有 API_BASE_URL 环境变量来决定参数
const genAIOptions = apiBaseUrl ? { apiKey, apiBaseUrl } : { apiKey }
const genAI = new GoogleGenerativeAI(genAIOptions)
const genAI = new GoogleGenerativeAI(apiKey)

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

1 comment on commit 5fbfb89

@vercel
Copy link

@vercel vercel bot commented on 5fbfb89 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.