mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-20 18:30:15 +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,6 +1,6 @@
|
|||
{
|
||||
"name": "librechat-data-provider",
|
||||
"version": "0.7.59",
|
||||
"version": "0.7.60",
|
||||
"description": "data services for librechat apps",
|
||||
"main": "dist/index.js",
|
||||
"module": "dist/index.es.js",
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ export type TSubmission = {
|
|||
initialResponse?: TMessage;
|
||||
conversation: Partial<TConversation>;
|
||||
endpointOption: TEndpointOption;
|
||||
clientTimestamp?: string;
|
||||
};
|
||||
|
||||
export type EventSubmission = Omit<TSubmission, 'initialResponse'> & { initialResponse: TMessage };
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@ export type AssistantCreateParams = {
|
|||
tools?: Array<FunctionTool | string>;
|
||||
endpoint: AssistantsEndpoint;
|
||||
version: number | string;
|
||||
append_current_datetime?: boolean;
|
||||
};
|
||||
|
||||
export type AssistantUpdateParams = {
|
||||
|
|
@ -113,6 +114,7 @@ export type AssistantUpdateParams = {
|
|||
tools?: Array<FunctionTool | string>;
|
||||
tool_resources?: ToolResources;
|
||||
endpoint: AssistantsEndpoint;
|
||||
append_current_datetime?: boolean;
|
||||
};
|
||||
|
||||
export type AssistantListParams = {
|
||||
|
|
@ -528,6 +530,7 @@ export type AssistantDocument = {
|
|||
actions?: string[];
|
||||
createdAt?: Date;
|
||||
updatedAt?: Date;
|
||||
append_current_datetime?: boolean;
|
||||
};
|
||||
|
||||
/* Agent types */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue