Skip to content

Commit

Permalink
🐛 fix: Correct Endpoint/Icon Handling, Update Module Resolutions (dan…
Browse files Browse the repository at this point in the history
…ny-avila#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
  • Loading branch information
danny-avila authored and dbirks committed Jan 7, 2025
1 parent cc352fa commit 5334fda
Show file tree
Hide file tree
Showing 13 changed files with 204 additions and 197 deletions.
1 change: 0 additions & 1 deletion api/models/schema/key.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const keySchema = mongoose.Schema({
},
expiresAt: {
type: Date,
expires: 0,
},
});

Expand Down
1 change: 1 addition & 0 deletions api/server/controllers/agents/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ class AgentClient extends BaseClient {
resendFiles: this.options.resendFiles,
imageDetail: this.options.imageDetail,
spec: this.options.spec,
iconURL: this.options.iconURL,
},
// TODO: PARSE OPTIONS BY PROVIDER, MAY CONTAIN SENSITIVE DATA
runOptions,
Expand Down
4 changes: 3 additions & 1 deletion api/server/services/Endpoints/agents/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ const { logger } = require('~/config');

const buildOptions = (req, endpoint, parsedBody) => {
const {
spec,
iconURL,
agent_id,
instructions,
spec,
maxContextTokens,
resendFiles = true,
...model_parameters
Expand All @@ -20,6 +21,7 @@ const buildOptions = (req, endpoint, parsedBody) => {

const endpointOption = {
spec,
iconURL,
endpoint,
agent_id,
resendFiles,
Expand Down
1 change: 1 addition & 0 deletions api/server/services/Endpoints/agents/initialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ const initializeClient = async ({ req, res, endpointOption }) => {
collectedUsage,
artifactPromises,
spec: endpointOption.spec,
iconURL: endpointOption.iconURL,
agentConfigs,
endpoint: EModelEndpoint.agents,
maxContextTokens: primaryConfig.maxContextTokens,
Expand Down
2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,6 @@
"typescript": "^5.0.4",
"vite": "^5.1.1",
"vite-plugin-node-polyfills": "^0.17.0",
"vite-plugin-pwa": "^0.20.5"
"vite-plugin-pwa": "^0.21.1"
}
}
8 changes: 6 additions & 2 deletions client/src/components/Chat/Input/HeaderOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useRecoilState } from 'recoil';
import { Settings2 } from 'lucide-react';
import { Root, Anchor } from '@radix-ui/react-popover';
import { useState, useEffect, useMemo } from 'react';
import { useGetEndpointsQuery } from 'librechat-data-provider/react-query';
import { tConvoUpdateSchema, EModelEndpoint, isParamEndpoint } from 'librechat-data-provider';
import type { TPreset, TInterfaceConfig } from 'librechat-data-provider';
import { EndpointSettings, SaveAsPresetDialog, AlternativeSettings } from '~/components/Endpoints';
Expand All @@ -11,13 +12,15 @@ import { useSetIndexOptions, useLocalize } from '~/hooks';
import OptionsPopover from './OptionsPopover';
import PopoverButtons from './PopoverButtons';
import { useChatContext } from '~/Providers';
import { getEndpointField } from '~/utils';
import store from '~/store';

export default function HeaderOptions({
interfaceConfig,
}: {
interfaceConfig?: Partial<TInterfaceConfig>;
}) {
const { data: endpointsConfig } = useGetEndpointsQuery();
const [saveAsDialogShow, setSaveAsDialogShow] = useState<boolean>(false);
const [showPluginStoreDialog, setShowPluginStoreDialog] = useRecoilState(
store.showPluginStoreDialog,
Expand All @@ -27,8 +30,7 @@ export default function HeaderOptions({
const { showPopover, conversation, latestMessage, setShowPopover, setShowBingToneSetting } =
useChatContext();
const { setOption } = useSetIndexOptions();

const { endpoint, endpointType, conversationId, jailbreak = false } = conversation ?? {};
const { endpoint, conversationId, jailbreak = false } = conversation ?? {};

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

const endpointType = getEndpointField(endpointsConfig, endpoint, 'type');
const paramEndpoint = isParamEndpoint(endpoint, endpointType);

return (
<Root
open={showPopover}
Expand Down
7 changes: 4 additions & 3 deletions client/src/components/Chat/Messages/MessageParts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ export default function Message(props: TMessageProps) {
const iconData = useMemo(
() =>
({
endpoint: conversation?.endpoint,
model: conversation?.model ?? message?.model,
iconURL: conversation?.iconURL ?? message?.iconURL ?? '',
endpoint: message?.endpoint ?? conversation?.endpoint,
model: message?.model ?? conversation?.model,
iconURL: message?.iconURL ?? conversation?.iconURL,
modelLabel: conversation?.chatGptLabel ?? conversation?.modelLabel,
isCreatedByUser: message?.isCreatedByUser,
} as TMessage & { modelLabel?: string }),
Expand All @@ -53,6 +53,7 @@ export default function Message(props: TMessageProps) {
conversation?.model,
message?.model,
message?.iconURL,
message?.endpoint,
message?.isCreatedByUser,
],
);
Expand Down
7 changes: 4 additions & 3 deletions client/src/components/Chat/Messages/ui/MessageRender.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ const MessageRender = memo(
const iconData = useMemo(
() =>
({
endpoint: conversation?.endpoint,
model: conversation?.model ?? msg?.model,
iconURL: conversation?.iconURL ?? msg?.iconURL ?? '',
endpoint: msg?.endpoint ?? conversation?.endpoint,
model: msg?.model ?? conversation?.model,
iconURL: msg?.iconURL ?? conversation?.iconURL,
modelLabel: conversation?.chatGptLabel ?? conversation?.modelLabel,
isCreatedByUser: msg?.isCreatedByUser,
} as TMessage & { modelLabel?: string }),
Expand All @@ -83,6 +83,7 @@ const MessageRender = memo(
conversation?.model,
msg?.model,
msg?.iconURL,
msg?.endpoint,
msg?.isCreatedByUser,
],
);
Expand Down
7 changes: 4 additions & 3 deletions client/src/components/Messages/ContentRender.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ const ContentRender = memo(
const iconData = useMemo(
() =>
({
endpoint: conversation?.endpoint,
model: conversation?.model ?? msg?.model,
iconURL: conversation?.iconURL ?? msg?.iconURL ?? '',
endpoint: msg?.endpoint ?? conversation?.endpoint,
model: msg?.model ?? conversation?.model,
iconURL: msg?.iconURL ?? conversation?.iconURL,
modelLabel: conversation?.chatGptLabel ?? conversation?.modelLabel,
isCreatedByUser: msg?.isCreatedByUser,
} as TMessage & { modelLabel?: string }),
Expand All @@ -82,6 +82,7 @@ const ContentRender = memo(
conversation?.model,
msg?.model,
msg?.iconURL,
msg?.endpoint,
msg?.isCreatedByUser,
],
);
Expand Down
Loading

0 comments on commit 5334fda

Please sign in to comment.