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:
Danny Avila 2024-12-11 15:26:18 -05:00 committed by GitHub
parent b5c9144127
commit 1dbe6ee75d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
38 changed files with 378 additions and 67 deletions

View file

@ -19,6 +19,7 @@ import { useAssistantsMapContext, useToastContext } from '~/Providers';
import { useSelectAssistant, useLocalize } from '~/hooks';
import { ToolSelectDialog } from '~/components/Tools';
import CapabilitiesForm from './CapabilitiesForm';
import AppendDateCheckbox from './AppendDateCheckbox';
import { SelectDropDown } from '~/components/ui';
import AssistantAvatar from './AssistantAvatar';
import AssistantSelect from './AssistantSelect';
@ -63,7 +64,7 @@ export default function AssistantPanel({
const [showToolDialog, setShowToolDialog] = useState(false);
const { control, handleSubmit, reset } = methods;
const { control, handleSubmit, reset, setValue, getValues } = methods;
const assistant = useWatch({ control, name: 'assistant' });
const functions = useWatch({ control, name: 'functions' });
const assistant_id = useWatch({ control, name: 'id' });
@ -167,7 +168,7 @@ export default function AssistantPanel({
instructions,
conversation_starters: starters,
model,
// file_ids, // TODO: add file handling here
append_current_datetime,
} = data;
if (assistant_id) {
@ -181,6 +182,7 @@ export default function AssistantPanel({
model,
tools,
endpoint,
append_current_datetime,
},
});
return;
@ -195,6 +197,7 @@ export default function AssistantPanel({
tools,
endpoint,
version,
append_current_datetime,
});
};
@ -325,6 +328,9 @@ export default function AssistantPanel({
/>
</div>
{/* Append Today's Date */}
<AppendDateCheckbox control={control} setValue={setValue} getValues={getValues} />
{/* Conversation Starters */}
<div className="relative mb-6">
{/* the label of conversation starters is in the component */}