diff --git a/.env.example b/.env.example index ff9edb2fc58..b0a0f20b9fc 100644 --- a/.env.example +++ b/.env.example @@ -76,6 +76,7 @@ PROXY= # SHUTTLEAI_API_KEY= # TOGETHERAI_API_KEY= # UNIFY_API_KEY= +# XAI_API_KEY= #============# # Anthropic # diff --git a/api/app/clients/ChatGPTClient.js b/api/app/clients/ChatGPTClient.js index 104e9e5ac3f..22f7cf31385 100644 --- a/api/app/clients/ChatGPTClient.js +++ b/api/app/clients/ChatGPTClient.js @@ -678,7 +678,6 @@ ${botMessage.message} const instructionsPayload = { role: 'system', - name: 'instructions', content: promptPrefix, }; diff --git a/api/app/clients/OpenAIClient.js b/api/app/clients/OpenAIClient.js index bc773db1724..848547314b8 100644 --- a/api/app/clients/OpenAIClient.js +++ b/api/app/clients/OpenAIClient.js @@ -553,7 +553,6 @@ class OpenAIClient extends BaseClient { promptPrefix = `Instructions:\n${promptPrefix.trim()}`; instructions = { role: 'system', - name: 'instructions', content: promptPrefix, }; diff --git a/api/app/clients/PluginsClient.js b/api/app/clients/PluginsClient.js index da7988acaf6..4eb258df203 100644 --- a/api/app/clients/PluginsClient.js +++ b/api/app/clients/PluginsClient.js @@ -458,7 +458,6 @@ class PluginsClient extends OpenAIClient { const instructionsPayload = { role: 'system', - name: 'instructions', content: promptPrefix, }; diff --git a/api/app/clients/specs/OpenAIClient.test.js b/api/app/clients/specs/OpenAIClient.test.js index 0725efd9d83..556cee745ed 100644 --- a/api/app/clients/specs/OpenAIClient.test.js +++ b/api/app/clients/specs/OpenAIClient.test.js @@ -446,7 +446,7 @@ describe('OpenAIClient', () => { promptPrefix: 'Test Prefix', }); expect(result).toHaveProperty('prompt'); - const instructions = result.prompt.find((item) => item.name === 'instructions'); + const instructions = result.prompt.find((item) => item.content.includes('Test Prefix')); expect(instructions).toBeDefined(); expect(instructions.content).toContain('Test Prefix'); }); @@ -476,7 +476,9 @@ describe('OpenAIClient', () => { const result = await client.buildMessages(messages, parentMessageId, { isChatCompletion: true, }); - const instructions = result.prompt.find((item) => item.name === 'instructions'); + const instructions = result.prompt.find((item) => + item.content.includes('Test Prefix from options'), + ); expect(instructions.content).toContain('Test Prefix from options'); }); @@ -484,7 +486,7 @@ describe('OpenAIClient', () => { const result = await client.buildMessages(messages, parentMessageId, { isChatCompletion: true, }); - const instructions = result.prompt.find((item) => item.name === 'instructions'); + const instructions = result.prompt.find((item) => item.content.includes('Test Prefix')); expect(instructions).toBeUndefined(); }); diff --git a/client/public/assets/xai.svg b/client/public/assets/xai.svg new file mode 100644 index 00000000000..2aca45ed4f0 --- /dev/null +++ b/client/public/assets/xai.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/components/Chat/Menus/Endpoints/UnknownIcon.tsx b/client/src/components/Chat/Menus/Endpoints/UnknownIcon.tsx index 21574abbefa..a0a9ef220f9 100644 --- a/client/src/components/Chat/Menus/Endpoints/UnknownIcon.tsx +++ b/client/src/components/Chat/Menus/Endpoints/UnknownIcon.tsx @@ -1,6 +1,7 @@ import { EModelEndpoint, KnownEndpoints } from 'librechat-data-provider'; import { CustomMinimalIcon } from '~/components/svg'; import { IconContext } from '~/common'; +import { cn } from '~/utils'; const knownEndpointAssets = { [KnownEndpoints.anyscale]: '/assets/anyscale.png', @@ -18,12 +19,19 @@ const knownEndpointAssets = { [KnownEndpoints.shuttleai]: '/assets/shuttleai.png', [KnownEndpoints['together.ai']]: '/assets/together.png', [KnownEndpoints.unify]: '/assets/unify.webp', + [KnownEndpoints.xai]: '/assets/xai.svg', }; const knownEndpointClasses = { [KnownEndpoints.cohere]: { [IconContext.landing]: 'p-2', }, + [KnownEndpoints.xai]: { + [IconContext.landing]: 'p-2', + [IconContext.menuItem]: 'bg-white', + [IconContext.message]: 'bg-white', + [IconContext.nav]: 'bg-white', + }, }; const getKnownClass = ({ @@ -39,10 +47,10 @@ const getKnownClass = ({ return className; } - const match = knownEndpointClasses[currentEndpoint]?.[context]; + const match = knownEndpointClasses[currentEndpoint]?.[context] ?? ''; const defaultClass = context === IconContext.landing ? '' : className; - return match ?? defaultClass; + return cn(match, defaultClass); }; export default function UnknownIcon({ @@ -61,7 +69,6 @@ export default function UnknownIcon({ return ; } - console.log('UnknownIcon', endpoint); const currentEndpoint = endpoint.toLowerCase(); if (iconURL) { diff --git a/package-lock.json b/package-lock.json index b72673368d0..74536ed1bb6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -36283,7 +36283,7 @@ }, "packages/data-provider": { "name": "librechat-data-provider", - "version": "0.7.52", + "version": "0.7.53", "license": "ISC", "dependencies": { "@types/js-yaml": "^4.0.9", diff --git a/packages/data-provider/package.json b/packages/data-provider/package.json index b68c5ce1990..bfc6776dae0 100644 --- a/packages/data-provider/package.json +++ b/packages/data-provider/package.json @@ -1,6 +1,6 @@ { "name": "librechat-data-provider", - "version": "0.7.52", + "version": "0.7.53", "description": "data services for librechat apps", "main": "dist/index.js", "module": "dist/index.es.js", diff --git a/packages/data-provider/src/config.ts b/packages/data-provider/src/config.ts index 5f503203313..04f3faf0771 100644 --- a/packages/data-provider/src/config.ts +++ b/packages/data-provider/src/config.ts @@ -550,6 +550,7 @@ export enum KnownEndpoints { shuttleai = 'shuttleai', 'together.ai' = 'together.ai', unify = 'unify', + xai = 'xai', } export enum FetchTokenConfig { @@ -584,7 +585,8 @@ export const alternateName = { [EModelEndpoint.anthropic]: 'Anthropic', [EModelEndpoint.custom]: 'Custom', [EModelEndpoint.bedrock]: 'AWS Bedrock', - ollama: 'Ollama', + [KnownEndpoints.ollama]: 'Ollama', + [KnownEndpoints.xai]: 'xAI', }; const sharedOpenAIModels = [