mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 00:40:14 +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
|
|
@ -128,6 +128,7 @@ export const defaultAssistantFormValues = {
|
|||
code_interpreter: false,
|
||||
image_vision: false,
|
||||
retrieval: false,
|
||||
append_current_datetime: false,
|
||||
};
|
||||
|
||||
export const defaultAgentFormValues = {
|
||||
|
|
@ -451,6 +452,7 @@ export const tMessageSchema = z.object({
|
|||
isEdited: z.boolean().optional(),
|
||||
isCreatedByUser: z.boolean(),
|
||||
error: z.boolean().optional(),
|
||||
clientTimestamp: z.string().optional(),
|
||||
createdAt: z
|
||||
.string()
|
||||
.optional()
|
||||
|
|
@ -485,6 +487,7 @@ export type TMessage = z.input<typeof tMessageSchema> & {
|
|||
depth?: number;
|
||||
siblingIndex?: number;
|
||||
attachments?: TAttachment[];
|
||||
clientTimestamp?: string;
|
||||
};
|
||||
|
||||
export const coerceNumber = z.union([z.number(), z.string()]).transform((val) => {
|
||||
|
|
@ -596,6 +599,7 @@ export const tConversationSchema = z.object({
|
|||
agentOptions: tAgentOptionsSchema.nullable().optional(),
|
||||
/** @deprecated Prefer `modelLabel` over `chatGptLabel` */
|
||||
chatGptLabel: z.string().nullable().optional(),
|
||||
append_current_datetime: z.boolean().optional(),
|
||||
});
|
||||
|
||||
export const tPresetSchema = tConversationSchema
|
||||
|
|
@ -849,6 +853,7 @@ export const assistantSchema = tConversationSchema
|
|||
iconURL: true,
|
||||
greeting: true,
|
||||
spec: true,
|
||||
append_current_datetime: true,
|
||||
})
|
||||
.transform((obj) => ({
|
||||
...obj,
|
||||
|
|
@ -859,6 +864,7 @@ export const assistantSchema = tConversationSchema
|
|||
iconURL: obj.iconURL ?? undefined,
|
||||
greeting: obj.greeting ?? undefined,
|
||||
spec: obj.spec ?? undefined,
|
||||
append_current_datetime: obj.append_current_datetime ?? false,
|
||||
}))
|
||||
.catch(() => ({
|
||||
model: openAISettings.model.default,
|
||||
|
|
@ -868,6 +874,7 @@ export const assistantSchema = tConversationSchema
|
|||
iconURL: undefined,
|
||||
greeting: undefined,
|
||||
spec: undefined,
|
||||
append_current_datetime: false,
|
||||
}));
|
||||
|
||||
export const compactAssistantSchema = tConversationSchema
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue