🛠️ 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:
Danny Avila 2025-08-20 13:21:47 -04:00 committed by GitHub
parent da4aa37493
commit 49cd3894aa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 39 additions and 18 deletions

View file

@ -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 };