diff --git a/src/components/chat-container/chat-container.tsx b/src/components/chat-container/chat-container.tsx index eaff6796870f36ab5770edfd0d57b7a8103feb5e..aa906f1d42f5082b0f09decd2672da91d79c56d7 100644 --- a/src/components/chat-container/chat-container.tsx +++ b/src/components/chat-container/chat-container.tsx @@ -24,6 +24,13 @@ export interface ChatContainerProps { * @date 2023-10-15 19:10:35 */ close: () => void; + + /** + * 全屏行为 + * + * @memberof ChatContainerProps + */ + fullscreen: (target: boolean) => void; } interface ChatContainerState { @@ -177,6 +184,7 @@ export class ChatContainer extends Component< if (container) { container.requestFullscreen(); this.setState({ isFullScreen: true }); + this.props.fullscreen(true); } } @@ -190,6 +198,7 @@ export class ChatContainer extends Component< if (this.state.isFullScreen) { document?.exitFullscreen(); this.setState({ isFullScreen: false }); + this.props.fullscreen(false); } } diff --git a/src/controller/ai-chat/ai-chat.controller.ts b/src/controller/ai-chat/ai-chat.controller.ts index d7f9d4c1f52e5128720e0c653e46808b4e1df1d1..bc2018f8277944fd1e0218f2cd950c504c96bca2 100644 --- a/src/controller/ai-chat/ai-chat.controller.ts +++ b/src/controller/ai-chat/ai-chat.controller.ts @@ -109,6 +109,9 @@ export class AiChatController { .filter(item => item.type !== 'ERROR') .map(item => item._origin), ); + if (this.opts.action) { + this.opts.action('question', input); + } } /** @@ -139,6 +142,9 @@ export class AiChatController { this.messages.value.splice(i, 1); this.messages.value = [...this.messages.value]; } + if (this.opts.action) { + this.opts.action('deletemsg', message); + } } /** @@ -172,6 +178,9 @@ export class AiChatController { this.messages.value.splice(i - 1, 2); this.question(lastques); } + if (this.opts.action) { + this.opts.action('refreshmsg', message); + } } /** @@ -183,5 +192,8 @@ export class AiChatController { copyMessage(message: IChatMessage) { const text = message.content; TextUtil.copy(text); + if (this.opts.action) { + this.opts.action('copymsg', message); + } } } diff --git a/src/controller/chat/chat.controller.ts b/src/controller/chat/chat.controller.ts index 785f40d384c8fe18411e4a5c795ebc373be86323..7c3f1688bd42ae5a271ce6121c2edaf282a2d355 100644 --- a/src/controller/chat/chat.controller.ts +++ b/src/controller/chat/chat.controller.ts @@ -43,6 +43,11 @@ export class ChatController { opts.closed(); } }, + fullscreen: (target: boolean) => { + if (opts.fullscreen) { + opts.fullscreen(target); + } + }, }), this.container, ); diff --git a/src/interface/i-chat-options/i-chat-options.ts b/src/interface/i-chat-options/i-chat-options.ts index 2d205b85f628c597d271f57fb7051d2cecde5133..97fbfef62a3a5208697342b88949a823f5ca439e 100644 --- a/src/interface/i-chat-options/i-chat-options.ts +++ b/src/interface/i-chat-options/i-chat-options.ts @@ -39,6 +39,14 @@ export interface IChatOptions { */ action?(action: string, params?: T): Promise; + /** + * 全屏操作 + * + * @param {boolean} target + * @memberof IChatOptions + */ + fullscreen?(target: boolean): void; + /** * 聊天窗口呈现 *