mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-09-22 06:00:56 +02:00
🛠️ fix: Restrict Editable Content Types & Consolidate Typing (#9173)
* fix: only allow editing expected content types & align typing app-wide * chore: update TPayload to use TEditedContent type for editedContent
This commit is contained in:
parent
da4aa37493
commit
49cd3894aa
5 changed files with 39 additions and 18 deletions
|
@ -11,6 +11,7 @@ import type {
|
|||
} from './schemas';
|
||||
import type { SettingDefinition } from './generate';
|
||||
import type { TMinimalFeedback } from './feedback';
|
||||
import type { ContentTypes } from './types/runs';
|
||||
import type { Agent } from './types/assistants';
|
||||
|
||||
export * from './schemas';
|
||||
|
@ -108,13 +109,21 @@ export type TPayload = Partial<TMessage> &
|
|||
messages?: TMessages;
|
||||
isTemporary: boolean;
|
||||
ephemeralAgent?: TEphemeralAgent | null;
|
||||
editedContent?: {
|
||||
index: number;
|
||||
text: string;
|
||||
type: 'text' | 'think';
|
||||
} | null;
|
||||
editedContent?: TEditedContent | null;
|
||||
};
|
||||
|
||||
export type TEditedContent =
|
||||
| {
|
||||
index: number;
|
||||
type: ContentTypes.THINK;
|
||||
[ContentTypes.THINK]: string;
|
||||
}
|
||||
| {
|
||||
index: number;
|
||||
type: ContentTypes.TEXT;
|
||||
[ContentTypes.TEXT]: string;
|
||||
};
|
||||
|
||||
export type TSubmission = {
|
||||
plugin?: TResPlugin;
|
||||
plugins?: TResPlugin[];
|
||||
|
@ -129,11 +138,7 @@ export type TSubmission = {
|
|||
endpointOption: TEndpointOption;
|
||||
clientTimestamp?: string;
|
||||
ephemeralAgent?: TEphemeralAgent | null;
|
||||
editedContent?: {
|
||||
index: number;
|
||||
text: string;
|
||||
type: 'text' | 'think';
|
||||
} | null;
|
||||
editedContent?: TEditedContent | null;
|
||||
};
|
||||
|
||||
export type EventSubmission = Omit<TSubmission, 'initialResponse'> & { initialResponse: TMessage };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue