Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

feat(bingai.js): add context and systemMessage parameters to askBing function feat(conversationPreset.js): add context and systemMessage fields to conversation preset schema feat(askBingAI.js): pass context and systemMessage parameters to ask function feat(Settings.jsx): add toneStyle prop to BingAISettings component feat(BingAIOptions/index.jsx): add useEffect to check if advanced mode is needed feat(cleanupPreset.js): add context and systemMessage fields to cleaned up preset object feat(getDefaultConversation.js): add context and systemMessage fields to default conversation object feat(handleSubmit.js): add context and systemMessage fields to message object

Danny Avilabb75b6df3b6c
diff --git a/api/app/clients/bingai.js b/api/app/clients/bingai.js
index 0865a10b8d..5dbc377b63 100644
--- a/api/app/clients/bingai.js
+++ b/api/app/clients/bingai.js
@@ -7,6 +7,8 @@ const askBing = async ({
conversationId,
jailbreak,
jailbreakConversationId,
+ context,
+ systemMessage,
conversationSignature,
clientId,
invocationId,
@@ -30,8 +32,10 @@ const askBing = async ({
let options = {
jailbreakConversationId: jailbreakConversationId || jailbreak,
+ context,
+ systemMessage,
parentMessageId,
- conversationId,
+ conversationId: jailbreakConversationId ? jailbreakConversationId : conversationId,
toneStyle,
onProgress
};
diff --git a/api/models/schema/conversationPreset.js b/api/models/schema/conversationPreset.js
index aead0ab796..219c5c5045 100644
--- a/api/models/schema/conversationPreset.js
+++ b/api/models/schema/conversationPreset.js
@@ -55,6 +55,14 @@ module.exports = {
type: String,
default: null
},
+ context: {
+ type: String,
+ default: null
+ },
+ systemMessage: {
+ type: String,
+ default: null
+ },
clientId: {
type: String,
default: null
diff --git a/api/server/routes/askBingAI.js b/api/server/routes/askBingAI.js
index eb6e18e328..50dd517433 100644
--- a/api/server/routes/askBingAI.js
+++ b/api/server/routes/askBingAI.js
@@ -35,6 +35,8 @@ router.post('/', async (req, res) => {
const endpointOption = {
jailbreak: req.body?.jailbreak || false,
jailbreakConversationId: req.body?.jailbreakConversationId || null,
+ systemMessage: req.body?.systemMessage || null,
+ context: req.body?.context || null,
conversationSignature: req.body?.conversationSignature || null,
clientId: req.body?.clientId || null,
invocationId: req.body?.invocationId || null,
@@ -58,6 +60,7 @@ router.post('/', async (req, res) => {
});
}
+ // eslint-disable-next-line no-use-before-define
return await ask({
isNewConversation,
userMessage,
diff --git a/client/src/components/Endpoints/BingAI/Settings.jsx b/client/src/components/Endpoints/BingAI/Settings.jsx
index 2017e63fd3..730169ea80 100644
--- a/client/src/components/Endpoints/BingAI/Settings.jsx
+++ b/client/src/components/Endpoints/BingAI/Settings.jsx
@@ -77,7 +77,7 @@ function Settings(props) {
disabled={readonly}
value={context || ''}
onChange={e => setContext(e.target.value || null)}
- placeholder="Bing can use up to 7k tokens for 'context', text that it can reference per 1 conversation. The specific limit is not known but may run into errors exceeding 7k tokens"
+ placeholder="Bing can use up to 7k tokens for 'context', which it can reference for the conversation. The specific limit is not known but may run into errors exceeding 7k tokens"
className={cn(
defaultTextProps,
'flex max-h-[300px] min-h-[100px] w-full resize-none px-3 py-2'
@@ -126,10 +126,10 @@ function Settings(props) {
disabled={readonly}
value={systemMessage || ''}
onChange={e => setSystemMessage(e.target.value || null)}
- placeholder="WARNING: Misuse of this feature can get you BANNED from using Bing! Click on 'System Message' for full instructions and the default message if omitted, which is the 'Sydney' preset that is considered safe."
+ placeholder="WARNING: Misuse of this feature can get you BANNED from using Bing! Click on 'System Message' for full instructions and the default message if omitted, which is the 'Sydney' preset that is considered safe. Leave blank for the default message."
className={cn(
defaultTextProps,
- 'flex max-h-[300px] min-h-[148px] w-full resize-none px-3 py-2 '
+ 'flex max-h-[300px] min-h-[148px] w-full resize-none px-3 py-2 placeholder:text-red-400'
)}
/>
</>
diff --git a/client/src/components/Endpoints/Settings.jsx b/client/src/components/Endpoints/Settings.jsx
index be224f5112..109d5d56c3 100644
--- a/client/src/components/Endpoints/Settings.jsx
+++ b/client/src/components/Endpoints/Settings.jsx
@@ -24,6 +24,7 @@ const Settings = ({ preset, ...props }) => {
else if (endpoint === 'bingAI')
return (
<BingAISettings
+ toneStyle={preset?.toneStyle}
context={preset?.context}
systemMessage={preset?.systemMessage}
jailbreak={preset?.jailbreak}
diff --git a/client/src/components/Input/BingAIOptions/index.jsx b/client/src/components/Input/BingAIOptions/index.jsx
index 6fb3bd389b..c19fb395b5 100644
--- a/client/src/components/Input/BingAIOptions/index.jsx
+++ b/client/src/components/Input/BingAIOptions/index.jsx
@@ -1,4 +1,4 @@
-import React, { useState } from 'react';
+import React, { useState, useEffect } from 'react';
import { useRecoilValue, useRecoilState } from 'recoil';
import { cn } from '~/utils';
import { Button } from '../../ui/Button.tsx';
@@ -15,7 +15,15 @@ function BingAIOptions() {
const [advancedMode, setAdvancedMode] = useState(false);
const [saveAsDialogShow, setSaveAsDialogShow] = useState(false);
const { endpoint, conversationId } = conversation;
- const { context, systemMessage, jailbreak } = conversation;
+ const { toneStyle, context, systemMessage, jailbreak } = conversation;
+
+ useEffect(() => {
+ if (endpoint !== 'bingAI') return;
+
+ const mustInAdvancedMode = context !== null || systemMessage !== null;
+
+ if (mustInAdvancedMode && !advancedMode) setAdvancedMode(true);
+ }, [conversation, advancedMode]);
if (endpoint !== 'bingAI') return null;
if (conversationId !== 'new') return null;
@@ -49,8 +57,6 @@ function BingAIOptions() {
}));
};
- const { toneStyle } = conversation;
-
const cardStyle =
'transition-colors shadow-md rounded-md min-w-[75px] font-normal bg-white border-black/10 hover:border-black/10 focus:border-black/10 dark:border-black/10 dark:hover:border-black/10 dark:focus:border-black/10 border dark:bg-gray-700 text-black dark:text-white';
const defaultClasses =
@@ -114,7 +120,7 @@ function BingAIOptions() {
</div>
<EndpointOptionsPopover
content={
- <div className="px-4 py-4 z-50">
+ <div className="z-50 px-4 py-4">
<Settings
context={context}
systemMessage={systemMessage}
diff --git a/client/src/utils/cleanupPreset.js b/client/src/utils/cleanupPreset.js
index 0e98fa88c2..6040e47b53 100644
--- a/client/src/utils/cleanupPreset.js
+++ b/client/src/utils/cleanupPreset.js
@@ -20,6 +20,8 @@ const cleanupPreset = _preset => {
endpoint,
presetId: _preset?.presetId || null,
jailbreak: _preset?.jailbreak || false,
+ context: _preset?.context || null,
+ systemMessage: _preset?.systemMessage || null,
jailbreakpresetId: _preset?._jailbreakpresetId || null,
presetSignature: null,
clientId: null,
diff --git a/client/src/utils/getDefaultConversation.js b/client/src/utils/getDefaultConversation.js
index c8141e02d7..bb6fdea767 100644
--- a/client/src/utils/getDefaultConversation.js
+++ b/client/src/utils/getDefaultConversation.js
@@ -16,6 +16,8 @@ const buildDefaultConversation = ({ conversation, endpoint, lastConversationSetu
...conversation,
endpoint,
jailbreak: lastConversationSetup?.jailbreak || false,
+ systemMessage: lastConversationSetup?.systemMessage || null,
+ context: lastConversationSetup?.context || null,
jailbreakConversationId: lastConversationSetup?.jailbreakConversationId || null,
conversationSignature: null,
clientId: null,
diff --git a/client/src/utils/handleSubmit.js b/client/src/utils/handleSubmit.js
index 01a9b72495..a3f7b739f1 100644
--- a/client/src/utils/handleSubmit.js
+++ b/client/src/utils/handleSubmit.js
@@ -42,6 +42,8 @@ const useMessageHandler = () => {
jailbreak: currentConversation?.jailbreak || false,
jailbreakConversationId: currentConversation?.jailbreakConversationId || null,
conversationSignature: currentConversation?.conversationSignature || null,
+ systemMessage: currentConversation?.systemMessage || null,
+ context: currentConversation?.context || null,
clientId: currentConversation?.clientId || null,
invocationId: currentConversation?.invocationId || 1,
toneStyle: currentConversation?.toneStyle || 'fast'