Skip to content

Commit

Permalink
🤖 feat: Add Vision Models; fix: Agents user_provided Keys (#4903)
Browse files Browse the repository at this point in the history
* 🤖 feat: add new vision models

* fix: agent key expiry setting and typing in useChatFunctions
  • Loading branch information
danny-avila authored Dec 8, 2024
1 parent 2875380 commit dc72848
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
13 changes: 8 additions & 5 deletions client/src/hooks/Chat/useChatFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ export default function useChatFunctions({
(msg) => msg.messageId === latestMessage?.parentMessageId,
);

let thread_id = parentMessage?.thread_id ?? latestMessage?.thread_id;
let thread_id = parentMessage?.thread_id ?? latestMessage?.thread_id ?? '';
if (!thread_id) {
thread_id = currentMessages.find((message) => message.thread_id)?.thread_id;
thread_id = currentMessages.find((message) => message.thread_id)?.thread_id ?? '';
}

const endpointsConfig = queryClient.getQueryData<TEndpointsConfig>([QueryKeys.endpoints]);
Expand Down Expand Up @@ -168,6 +168,8 @@ export default function useChatFunctions({
endpointOption.key = getExpiry();
endpointOption.thread_id = thread_id;
endpointOption.modelDisplayLabel = modelDisplayLabel;
} else {
endpointOption.key = new Date(Date.now() + 60 * 60 * 1000).toISOString();
}
const responseSender = getSender({ model: conversation?.model, ...endpointOption });

Expand All @@ -177,13 +179,14 @@ export default function useChatFunctions({
isCreatedByUser: true,
parentMessageId,
conversationId,
messageId: isContinued && messageId ? messageId : intermediateId,
messageId: isContinued && messageId != null && messageId ? messageId : intermediateId,
thread_id,
error: false,
};

const reuseFiles = (isRegenerate || resubmitFiles) && parentMessage?.files;
if (setFiles && reuseFiles && parentMessage.files?.length) {
const reuseFiles =
(isRegenerate || resubmitFiles) && parentMessage?.files && parentMessage.files.length > 0;
if (setFiles && reuseFiles === true) {
currentMsg.files = parentMessage.files;
setFiles(new Map());
setFilesToDelete({});
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/data-provider/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "librechat-data-provider",
"version": "0.7.57",
"version": "0.7.58",
"description": "data services for librechat apps",
"main": "dist/index.js",
"module": "dist/index.es.js",
Expand Down
7 changes: 7 additions & 0 deletions packages/data-provider/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,13 @@ export const visionModels = [
'gemini-pro-vision',
'claude-3',
'gemini-1.5',
'gemini-exp',
'moondream',
'llama3.2-vision',
'llama-3.2-90b-vision',
'llama-3.2-11b-vision',
'llama-3-2-90b-vision',
'llama-3-2-11b-vision',
];
export enum VisionModes {
generative = 'generative',
Expand Down

0 comments on commit dc72848

Please sign in to comment.