diff --git a/.changeset/dry-poets-confess.md b/.changeset/dry-poets-confess.md
new file mode 100644
index 00000000..2ab4b344
--- /dev/null
+++ b/.changeset/dry-poets-confess.md
@@ -0,0 +1,5 @@
+---
+'@difizen/magent-chat': patch
+---
+
+add chat error and waiting status
diff --git a/web-packages/magent-chat/src/chat-view/components/message/ai-message.tsx b/web-packages/magent-chat/src/chat-view/components/message/ai-message.tsx
index 59a2932c..414efb44 100644
--- a/web-packages/magent-chat/src/chat-view/components/message/ai-message.tsx
+++ b/web-packages/magent-chat/src/chat-view/components/message/ai-message.tsx
@@ -1,6 +1,7 @@
import { LoadingOutlined, RightOutlined } from '@ant-design/icons';
import { useInject, useObserve, ViewInstance } from '@difizen/mana-app';
import { l10n } from '@difizen/mana-l10n';
+import { Alert } from 'antd';
import classNames from 'classnames';
import debounce from 'lodash.debounce';
import type { ReactNode } from 'react';
@@ -109,12 +110,28 @@ export const AIMessageContent = (props: AIMessageProps) => {
className={classNames({
['chat-message-ai-empty']: true,
['chat-message-ai-error']: item.error,
+ ['chat-message-ai-waiting']: item.state === AnswerState.WAITING,
})}
>
{item.state === AnswerState.RECEIVING && (
)}
+ {item.state === AnswerState.FAIL && (
+
+ )}
+ {item.state === AnswerState.WAITING && (
+
+
+ {l10n.t('请求中...')}
+
+ )}
@@ -143,6 +160,15 @@ export const AIMessageContent = (props: AIMessageProps) => {
{item.state === AnswerState.RECEIVING && (
)}
+ {item.state === AnswerState.FAIL && (
+
+ )}
);
diff --git a/web-packages/magent-chat/src/chat-view/components/message/index.less b/web-packages/magent-chat/src/chat-view/components/message/index.less
index 138f7a3e..2b179c46 100644
--- a/web-packages/magent-chat/src/chat-view/components/message/index.less
+++ b/web-packages/magent-chat/src/chat-view/components/message/index.less
@@ -173,6 +173,20 @@
width: 100%;
}
+ &-waiting {
+ padding: 10px 0 2px 12px;
+ font-size: 14px;
+ color: rgba(0, 0, 0, 60%);
+
+ .chat-message-ai-content {
+ min-height: 30px;
+ }
+ }
+
+ &-fail {
+ padding: 8px 16px;
+ }
+
&-receiving {
color: var(--mana-text-quaternary);
padding: 8px 16px;
@@ -183,6 +197,7 @@
.chat-message-ai-content {
box-shadow: var(--mana-ant-box-shadow-tabs-overflow-bottom);
+ min-height: 30px;
}
.chat-message-addon-error {
diff --git a/web-packages/magent-chat/src/chat-view/components/message/message-op.tsx b/web-packages/magent-chat/src/chat-view/components/message/message-op.tsx
index 0caf03b1..17b727d3 100644
--- a/web-packages/magent-chat/src/chat-view/components/message/message-op.tsx
+++ b/web-packages/magent-chat/src/chat-view/components/message/message-op.tsx
@@ -11,6 +11,9 @@ export function MessageOp({
message: BaseChatMessageModel;
item: BaseChatMessageItemModel;
}) {
+ if (!item.content) {
+ return null;
+ }
return (