Skip to content

Commit 9a70918

Browse files
committed
🐛 fix: Correct Endpoint/Icon Handling, Update Module Resolutions (#5205)
* fix: agent modelSpec iconURLs not being recorded * fix: prioritize message properties over conversation defaults in icon data * fix: determine endpoint type from endpointsConfig * chore: type issue with setting.columnSpan * chore: remove redundant key indexing for keySchema * chore: bump version to 0.7.691 in package.json * chore: add stricter remark-gfm and mdast-util-gfm resolutions/overrides * chore: remove rollup override and bump vite-plugin-pwa * chore: reinstall remark-gfm for correct module resolution * chore: reinstall vite-plugun-pwa
1 parent d924f78 commit 9a70918

File tree

13 files changed

+204
-197
lines changed

13 files changed

+204
-197
lines changed

api/models/schema/key.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ const keySchema = mongoose.Schema({
1616
},
1717
expiresAt: {
1818
type: Date,
19-
expires: 0,
2019
},
2120
});
2221

api/server/controllers/agents/client.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ class AgentClient extends BaseClient {
193193
resendFiles: this.options.resendFiles,
194194
imageDetail: this.options.imageDetail,
195195
spec: this.options.spec,
196+
iconURL: this.options.iconURL,
196197
},
197198
// TODO: PARSE OPTIONS BY PROVIDER, MAY CONTAIN SENSITIVE DATA
198199
runOptions,

api/server/services/Endpoints/agents/build.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ const { logger } = require('~/config');
33

44
const buildOptions = (req, endpoint, parsedBody) => {
55
const {
6+
spec,
7+
iconURL,
68
agent_id,
79
instructions,
8-
spec,
910
maxContextTokens,
1011
resendFiles = true,
1112
...model_parameters
@@ -20,6 +21,7 @@ const buildOptions = (req, endpoint, parsedBody) => {
2021

2122
const endpointOption = {
2223
spec,
24+
iconURL,
2325
endpoint,
2426
agent_id,
2527
resendFiles,

api/server/services/Endpoints/agents/initialize.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ const initializeClient = async ({ req, res, endpointOption }) => {
226226
collectedUsage,
227227
artifactPromises,
228228
spec: endpointOption.spec,
229+
iconURL: endpointOption.iconURL,
229230
agentConfigs,
230231
endpoint: EModelEndpoint.agents,
231232
maxContextTokens: primaryConfig.maxContextTokens,

client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,6 @@
142142
"typescript": "^5.0.4",
143143
"vite": "^5.1.1",
144144
"vite-plugin-node-polyfills": "^0.17.0",
145-
"vite-plugin-pwa": "^0.20.5"
145+
"vite-plugin-pwa": "^0.21.1"
146146
}
147147
}

client/src/components/Chat/Input/HeaderOptions.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { useRecoilState } from 'recoil';
22
import { Settings2 } from 'lucide-react';
33
import { Root, Anchor } from '@radix-ui/react-popover';
44
import { useState, useEffect, useMemo } from 'react';
5+
import { useGetEndpointsQuery } from 'librechat-data-provider/react-query';
56
import { tConvoUpdateSchema, EModelEndpoint, isParamEndpoint } from 'librechat-data-provider';
67
import type { TPreset, TInterfaceConfig } from 'librechat-data-provider';
78
import { EndpointSettings, SaveAsPresetDialog, AlternativeSettings } from '~/components/Endpoints';
@@ -11,13 +12,15 @@ import { useSetIndexOptions, useLocalize } from '~/hooks';
1112
import OptionsPopover from './OptionsPopover';
1213
import PopoverButtons from './PopoverButtons';
1314
import { useChatContext } from '~/Providers';
15+
import { getEndpointField } from '~/utils';
1416
import store from '~/store';
1517

1618
export default function HeaderOptions({
1719
interfaceConfig,
1820
}: {
1921
interfaceConfig?: Partial<TInterfaceConfig>;
2022
}) {
23+
const { data: endpointsConfig } = useGetEndpointsQuery();
2124
const [saveAsDialogShow, setSaveAsDialogShow] = useState<boolean>(false);
2225
const [showPluginStoreDialog, setShowPluginStoreDialog] = useRecoilState(
2326
store.showPluginStoreDialog,
@@ -27,8 +30,7 @@ export default function HeaderOptions({
2730
const { showPopover, conversation, latestMessage, setShowPopover, setShowBingToneSetting } =
2831
useChatContext();
2932
const { setOption } = useSetIndexOptions();
30-
31-
const { endpoint, endpointType, conversationId, jailbreak = false } = conversation ?? {};
33+
const { endpoint, conversationId, jailbreak = false } = conversation ?? {};
3234

3335
const altConditions: { [key: string]: boolean } = {
3436
bingAI: !!(latestMessage && jailbreak && endpoint === 'bingAI'),
@@ -65,7 +67,9 @@ export default function HeaderOptions({
6567
? altSettings[endpoint]
6668
: () => setShowPopover((prev) => !prev);
6769

70+
const endpointType = getEndpointField(endpointsConfig, endpoint, 'type');
6871
const paramEndpoint = isParamEndpoint(endpoint, endpointType);
72+
6973
return (
7074
<Root
7175
open={showPopover}

client/src/components/Chat/Messages/MessageParts.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ export default function Message(props: TMessageProps) {
3939
const iconData = useMemo(
4040
() =>
4141
({
42-
endpoint: conversation?.endpoint,
43-
model: conversation?.model ?? message?.model,
44-
iconURL: conversation?.iconURL ?? message?.iconURL ?? '',
42+
endpoint: message?.endpoint ?? conversation?.endpoint,
43+
model: message?.model ?? conversation?.model,
44+
iconURL: message?.iconURL ?? conversation?.iconURL,
4545
modelLabel: conversation?.chatGptLabel ?? conversation?.modelLabel,
4646
isCreatedByUser: message?.isCreatedByUser,
4747
} as TMessage & { modelLabel?: string }),
@@ -53,6 +53,7 @@ export default function Message(props: TMessageProps) {
5353
conversation?.model,
5454
message?.model,
5555
message?.iconURL,
56+
message?.endpoint,
5657
message?.isCreatedByUser,
5758
],
5859
);

client/src/components/Chat/Messages/ui/MessageRender.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ const MessageRender = memo(
6969
const iconData = useMemo(
7070
() =>
7171
({
72-
endpoint: conversation?.endpoint,
73-
model: conversation?.model ?? msg?.model,
74-
iconURL: conversation?.iconURL ?? msg?.iconURL ?? '',
72+
endpoint: msg?.endpoint ?? conversation?.endpoint,
73+
model: msg?.model ?? conversation?.model,
74+
iconURL: msg?.iconURL ?? conversation?.iconURL,
7575
modelLabel: conversation?.chatGptLabel ?? conversation?.modelLabel,
7676
isCreatedByUser: msg?.isCreatedByUser,
7777
} as TMessage & { modelLabel?: string }),
@@ -83,6 +83,7 @@ const MessageRender = memo(
8383
conversation?.model,
8484
msg?.model,
8585
msg?.iconURL,
86+
msg?.endpoint,
8687
msg?.isCreatedByUser,
8788
],
8889
);

client/src/components/Messages/ContentRender.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ const ContentRender = memo(
6868
const iconData = useMemo(
6969
() =>
7070
({
71-
endpoint: conversation?.endpoint,
72-
model: conversation?.model ?? msg?.model,
73-
iconURL: conversation?.iconURL ?? msg?.iconURL ?? '',
71+
endpoint: msg?.endpoint ?? conversation?.endpoint,
72+
model: msg?.model ?? conversation?.model,
73+
iconURL: msg?.iconURL ?? conversation?.iconURL,
7474
modelLabel: conversation?.chatGptLabel ?? conversation?.modelLabel,
7575
isCreatedByUser: msg?.isCreatedByUser,
7676
} as TMessage & { modelLabel?: string }),
@@ -82,6 +82,7 @@ const ContentRender = memo(
8282
conversation?.model,
8383
msg?.model,
8484
msg?.iconURL,
85+
msg?.endpoint,
8586
msg?.isCreatedByUser,
8687
],
8788
);

0 commit comments

Comments
 (0)