mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-13 22:18:51 +01:00
⌚ feat: Add Current Datetime to Assistants (v1/v2) (#4952)
* Feature: Added ability to send current date and time to v1 and v2 assistants * remove date_feature.patch * fix: rename append_today_date to append_current_datetime * feat: Refactor time handling in chatV1 and chatV2, add date and time utility functions * fix: Add warning log and response for missing run values in abortRun middleware --------- Co-authored-by: Max Sanna <max@maxsanna.com>
This commit is contained in:
parent
b5c9144127
commit
1dbe6ee75d
38 changed files with 378 additions and 67 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import { Plus } from 'lucide-react';
|
||||
import { useCallback, useEffect, useRef, useMemo } from 'react';
|
||||
import { useCallback, useEffect, useRef } from 'react';
|
||||
import {
|
||||
Tools,
|
||||
FileSources,
|
||||
|
|
@ -37,6 +37,7 @@ const keys = new Set([
|
|||
'instructions',
|
||||
'conversation_starters',
|
||||
'model',
|
||||
'append_current_datetime',
|
||||
]);
|
||||
|
||||
export default function AssistantSelect({
|
||||
|
|
@ -69,7 +70,7 @@ export default function AssistantSelect({
|
|||
res.data.map((_assistant) => {
|
||||
const source =
|
||||
endpoint === EModelEndpoint.assistants ? FileSources.openai : FileSources.azure;
|
||||
const assistant = {
|
||||
const assistant: TAssistantOption = {
|
||||
..._assistant,
|
||||
label: _assistant.name ?? '',
|
||||
value: _assistant.id,
|
||||
|
|
@ -125,8 +126,11 @@ export default function AssistantSelect({
|
|||
|
||||
const assistantDoc = documentsMap?.get(_assistant.id);
|
||||
/* If no user updates, use the latest assistant docs */
|
||||
if (assistantDoc && !assistant.conversation_starters) {
|
||||
assistant.conversation_starters = assistantDoc.conversation_starters;
|
||||
if (assistantDoc) {
|
||||
if (!assistant.conversation_starters) {
|
||||
assistant.conversation_starters = assistantDoc.conversation_starters;
|
||||
}
|
||||
assistant.append_current_datetime = assistantDoc.append_current_datetime ?? false;
|
||||
}
|
||||
|
||||
return assistant;
|
||||
|
|
@ -184,6 +188,11 @@ export default function AssistantSelect({
|
|||
return;
|
||||
}
|
||||
|
||||
if (name === 'append_current_datetime') {
|
||||
formValues[name] = !!value;
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
name === 'conversation_starters' &&
|
||||
Array.isArray(value) &&
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue