mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-22 11:20:15 +01:00
fix(Bing): Use full cookies string instead of just _U cookie (#369)
This commit is contained in:
parent
112c6c5b19
commit
634849ec12
3 changed files with 20 additions and 17 deletions
|
|
@ -59,8 +59,9 @@ OPENAI_MODELS=gpt-3.5-turbo,gpt-3.5-turbo-0301,text-davinci-003,gpt-4
|
||||||
##########################
|
##########################
|
||||||
|
|
||||||
# Also used for Sydney and jailbreak
|
# Also used for Sydney and jailbreak
|
||||||
|
# As of 5/23/23, to use Bing, you will need your full cookie string from bing.com. Use dev tools or an extension while
|
||||||
# BingAI Tokens: the "_U" cookies value from bing.com
|
# logged into the site to view it in your network request Cookie header value. For full instructions, see my comment here:
|
||||||
|
# https://github.com/waylaidwanderer/node-chatgpt-api/issues/378#issuecomment-1559868368
|
||||||
# Set to "user_provided" to allow the user to provide its token from the UI.
|
# Set to "user_provided" to allow the user to provide its token from the UI.
|
||||||
# Leave it blank to disable this endpoint.
|
# Leave it blank to disable this endpoint.
|
||||||
BINGAI_TOKEN="user_provided"
|
BINGAI_TOKEN="user_provided"
|
||||||
|
|
|
||||||
|
|
@ -23,10 +23,10 @@ const askBing = async ({
|
||||||
|
|
||||||
const bingAIClient = new BingAIClient({
|
const bingAIClient = new BingAIClient({
|
||||||
// "_U" cookie from bing.com
|
// "_U" cookie from bing.com
|
||||||
userToken:
|
// userToken:
|
||||||
process.env.BINGAI_TOKEN == 'user_provided' ? token : process.env.BINGAI_TOKEN ?? null,
|
// process.env.BINGAI_TOKEN == 'user_provided' ? token : process.env.BINGAI_TOKEN ?? null,
|
||||||
// If the above doesn't work, provide all your cookies as a string instead
|
// If the above doesn't work, provide all your cookies as a string instead
|
||||||
// cookies: '',
|
cookies: process.env.BINGAI_TOKEN == 'user_provided' ? token : process.env.BINGAI_TOKEN ?? null,
|
||||||
debug: false,
|
debug: false,
|
||||||
cache: store,
|
cache: store,
|
||||||
host: process.env.BINGAI_HOST || null,
|
host: process.env.BINGAI_HOST || null,
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,6 @@
|
||||||
import React, { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import DialogTemplate from '../../ui/DialogTemplate';
|
import DialogTemplate from '../../ui/DialogTemplate';
|
||||||
import { Dialog } from '../../ui/Dialog.tsx';
|
import { Dialog } from '../../ui/Dialog.tsx';
|
||||||
import { Input } from '../../ui/Input.tsx';
|
|
||||||
import { Label } from '../../ui/Label.tsx';
|
|
||||||
import { cn } from '~/utils/';
|
|
||||||
import * as Checkbox from '@radix-ui/react-checkbox';
|
import * as Checkbox from '@radix-ui/react-checkbox';
|
||||||
import { CheckIcon } from '@radix-ui/react-icons';
|
import { CheckIcon } from '@radix-ui/react-icons';
|
||||||
import FileUpload from '../NewConversationMenu/FileUpload';
|
import FileUpload from '../NewConversationMenu/FileUpload';
|
||||||
|
|
@ -24,9 +21,6 @@ const SetTokenDialog = ({ open, onOpenChange, endpoint }) => {
|
||||||
const [showPanel, setShowPanel] = useState(false);
|
const [showPanel, setShowPanel] = useState(false);
|
||||||
const { getToken, saveToken } = store.useToken(endpoint);
|
const { getToken, saveToken } = store.useToken(endpoint);
|
||||||
|
|
||||||
const defaultTextProps =
|
|
||||||
'rounded-md border border-gray-300 bg-transparent text-sm shadow-[0_0_10px_rgba(0,0,0,0.10)] outline-none placeholder:text-gray-400 focus:outline-none focus:ring-gray-400 focus:ring-opacity-20 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-400 dark:bg-gray-700 dark:text-gray-50 dark:shadow-[0_0_15px_rgba(0,0,0,0.10)] dark:focus:border-gray-400 dark:focus:outline-none dark:focus:ring-0 dark:focus:ring-gray-400 dark:focus:ring-offset-0';
|
|
||||||
|
|
||||||
const submit = () => {
|
const submit = () => {
|
||||||
saveToken(token);
|
saveToken(token);
|
||||||
onOpenChange(false);
|
onOpenChange(false);
|
||||||
|
|
@ -49,13 +43,21 @@ const SetTokenDialog = ({ open, onOpenChange, endpoint }) => {
|
||||||
const helpText = {
|
const helpText = {
|
||||||
bingAI: (
|
bingAI: (
|
||||||
<small className="break-all text-gray-600">
|
<small className="break-all text-gray-600">
|
||||||
The Bing Access Token is the "_U" cookie from bing.com. Use dev tools or an extension while
|
{`As of 5/23/23, to use Bing, you will need your full cookie string from bing.com. Use dev tools or an extension while
|
||||||
logged into the site to view it.
|
logged into the site to view it in your network request Cookie header value. For full instructions, see my `}
|
||||||
|
<a
|
||||||
|
target="_blank"
|
||||||
|
href="https://github.com/waylaidwanderer/node-chatgpt-api/issues/378#issuecomment-1559868368"
|
||||||
|
rel="noreferrer"
|
||||||
|
className="text-blue-600 underline"
|
||||||
|
>
|
||||||
|
comment here
|
||||||
|
</a>
|
||||||
</small>
|
</small>
|
||||||
),
|
),
|
||||||
chatGPTBrowser: (
|
chatGPTBrowser: (
|
||||||
<small className="break-all text-gray-600">
|
<small className="break-all text-gray-600">
|
||||||
To get your Access token For ChatGPT 'Free Version', login to{' '}
|
{`To get your Access token For ChatGPT 'Free Version', login to `}
|
||||||
<a
|
<a
|
||||||
target="_blank"
|
target="_blank"
|
||||||
href="https://chat.openai.com"
|
href="https://chat.openai.com"
|
||||||
|
|
@ -96,8 +98,8 @@ const SetTokenDialog = ({ open, onOpenChange, endpoint }) => {
|
||||||
>
|
>
|
||||||
Create a Service Account
|
Create a Service Account
|
||||||
</a>
|
</a>
|
||||||
. Make sure to click 'Create and Continue' to give at least the 'Vertex AI User' role.
|
{`. Make sure to click 'Create and Continue' to give at least the 'Vertex AI User' role.
|
||||||
Lastly, create a JSON key to import here.
|
Lastly, create a JSON key to import here.`}
|
||||||
</small>
|
</small>
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue