Skip to content

Commit

Permalink
chatgpt_fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
ishandutta2007 committed May 10, 2024
1 parent 7b45b0e commit 639b43c
Show file tree
Hide file tree
Showing 10 changed files with 962 additions and 924 deletions.
79 changes: 53 additions & 26 deletions package-lock.json

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

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"watch": "chokidar src -c 'npm run build'"
},
"dependencies": {
"@esbuild/win32-x64": "^0.20.2",
"@geist-ui/core": "^2.3.8",
"@geist-ui/icons": "^1.0.2",
"@primer/octicons-react": "^17.9.0",
Expand All @@ -22,6 +21,7 @@
"github-markdown-css": "^5.1.0",
"i18next-browser-languagedetector": "^7.0.1",
"inter-ui": "^3.19.3",
"llm-playground-chain": "^0.0.6",
"lodash-es": "^4.17.21",
"ofetch": "^1.0.1",
"preact": "^10.11.3",
Expand Down Expand Up @@ -74,7 +74,8 @@
]
},
"engines": {
"node": ">=16.15.0 <17.0.0",
"npm": ">=8.19.4 <9.0.0"
"node": ">=18.17.1 <19.0.0",
"pnpm": ">=9.6.7",
"npm": ">=9.6.7 <10.0.0"
}
}
3 changes: 2 additions & 1 deletion src/background/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import Browser from 'webextension-polyfill'
import { getChatGPTChatIds, getProviderConfigs, ProviderType } from '../config'
// import { BARDProvider, sendMessageFeedbackBard } from './providers/bard'
import { isDate } from '../utils/parse'
import { ChatGPTProvider, getChatGPTAccessToken, sendMessageFeedback } from './providers/chatgpt'
// import { ChatGPTProvider, getChatGPTAccessToken, sendMessageFeedback } from './providers/chatgpt'
import { ChatGPTProvider, getChatGPTAccessToken, sendMessageFeedback } from 'llm-playground-chain'
import { OpenAIProvider } from './providers/openai'
import { Provider } from './types'

Expand Down
6 changes: 3 additions & 3 deletions src/background/providers/bard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class ChatError extends Error {
}

// async function request(token: string, method: string, path: string, data?: unknown) {
// return fetch(`https://chat.openai.com/backend-api${path}`, {
// return fetch(`https://chatgpt.com/backend-api${path}`, {
// method,
// headers: {
// 'Content-Type': 'application/json',
Expand Down Expand Up @@ -60,7 +60,7 @@ const cache = new ExpiryMap(10 * 1000)
// if (cache.get(KEY_ACCESS_TOKEN)) {
// return cache.get(KEY_ACCESS_TOKEN)
// }
// const resp = await fetch('https://chat.openai.com/api/auth/session')
// const resp = await fetch('https://chatgpt.com/api/auth/session')
// if (resp.status === 403) {
// throw new Error('CLOUDFLARE')
// }
Expand Down Expand Up @@ -95,7 +95,7 @@ export class BARDProvider implements Provider {
private async parseBartResponse(resp: string) {
const data = JSON.parse(resp.split('\n')[3])
const payload = JSON.parse(data[0][2])
console.log("payload", payload)
console.log('payload', payload)
if (!payload) {
throw new ChatError(
'Failed to access Bard, make sure you are logged in at https://bard.google.com',
Expand Down
Loading

0 comments on commit 639b43c

Please sign in to comment.