fix(api): enhance message status handling

- Updated MessageStatus type to include 'pending' as a new state, reflecting the message processing lifecycle.
- Modified CreateMessageDto and UpdateMessageDto interfaces to utilize the updated MessageStatus type for improved clarity and consistency in message status management.
This commit is contained in:
fullex 2025-12-28 21:24:00 +08:00
parent 5061472850
commit 942e014d92
2 changed files with 9 additions and 4 deletions

View File

@ -11,6 +11,7 @@ import type {
MessageData, MessageData,
MessageRole, MessageRole,
MessageStats, MessageStats,
MessageStatus,
TreeResponse TreeResponse
} from '@shared/data/types/message' } from '@shared/data/types/message'
import type { AssistantMeta, ModelMeta } from '@shared/data/types/meta' import type { AssistantMeta, ModelMeta } from '@shared/data/types/meta'
@ -30,7 +31,7 @@ export interface CreateMessageDto {
/** Message content */ /** Message content */
data: MessageData data: MessageData
/** Message status */ /** Message status */
status?: 'success' | 'error' | 'paused' status?: MessageStatus
/** Siblings group ID (0 = normal, >0 = multi-model group) */ /** Siblings group ID (0 = normal, >0 = multi-model group) */
siblingsGroupId?: number siblingsGroupId?: number
/** Assistant ID */ /** Assistant ID */
@ -58,7 +59,7 @@ export interface UpdateMessageDto {
/** Change siblings group */ /** Change siblings group */
siblingsGroupId?: number siblingsGroupId?: number
/** Update status */ /** Update status */
status?: 'success' | 'error' | 'paused' status?: MessageStatus
} }
/** /**

View File

@ -182,9 +182,13 @@ import type { AssistantMeta, ModelMeta } from './meta'
export type MessageRole = 'user' | 'assistant' | 'system' export type MessageRole = 'user' | 'assistant' | 'system'
/** /**
* Message status - final state after processing * Message status
* - pending: Placeholder created, streaming in progress
* - success: Completed successfully
* - error: Failed with error
* - paused: User stopped generation
*/ */
export type MessageStatus = 'success' | 'error' | 'paused' export type MessageStatus = 'pending' | 'success' | 'error' | 'paused'
/** /**
* Complete message entity as stored in database * Complete message entity as stored in database