mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-16 16:30:15 +01:00
🧊 refactor: iconURL Handling in Submission Flow (#10772)
- Updated `useChatFunctions` to derive `iconURL` from conversation data before parsing - Modified `parseCompactConvo` to explicitly omit `iconURL` from parsed conversations, reinforcing security measures around URL handling.
This commit is contained in:
parent
1477da4987
commit
28bdd0dfa6
2 changed files with 3 additions and 2 deletions
|
|
@ -168,6 +168,7 @@ export default function useChatFunctions({
|
||||||
|
|
||||||
const endpointsConfig = queryClient.getQueryData<TEndpointsConfig>([QueryKeys.endpoints]);
|
const endpointsConfig = queryClient.getQueryData<TEndpointsConfig>([QueryKeys.endpoints]);
|
||||||
const endpointType = getEndpointField(endpointsConfig, endpoint, 'type');
|
const endpointType = getEndpointField(endpointsConfig, endpoint, 'type');
|
||||||
|
const iconURL = conversation?.iconURL;
|
||||||
|
|
||||||
/** This becomes part of the `endpointOption` */
|
/** This becomes part of the `endpointOption` */
|
||||||
const convo = parseCompactConvo({
|
const convo = parseCompactConvo({
|
||||||
|
|
@ -248,9 +249,9 @@ export default function useChatFunctions({
|
||||||
conversationId,
|
conversationId,
|
||||||
unfinished: false,
|
unfinished: false,
|
||||||
isCreatedByUser: false,
|
isCreatedByUser: false,
|
||||||
iconURL: convo?.iconURL,
|
|
||||||
model: convo?.model,
|
model: convo?.model,
|
||||||
error: false,
|
error: false,
|
||||||
|
iconURL,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (isAssistantsEndpoint(endpoint)) {
|
if (isAssistantsEndpoint(endpoint)) {
|
||||||
|
|
|
||||||
|
|
@ -326,7 +326,7 @@ export const parseCompactConvo = ({
|
||||||
possibleValues?: TPossibleValues;
|
possibleValues?: TPossibleValues;
|
||||||
// TODO: POC for default schema
|
// TODO: POC for default schema
|
||||||
// defaultSchema?: Partial<EndpointSchema>,
|
// defaultSchema?: Partial<EndpointSchema>,
|
||||||
}) => {
|
}): Omit<s.TConversation, 'iconURL'> | null => {
|
||||||
if (!endpoint) {
|
if (!endpoint) {
|
||||||
throw new Error(`undefined endpoint: ${endpoint}`);
|
throw new Error(`undefined endpoint: ${endpoint}`);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue