feat(ai): 对话页接入实时语音、图片识别与失败重试

- 聊天 WebSocket 提到 app 级,语音分片与对话共用连接,补齐心跳、重连与连接单飞
- 语音输入走 asr_start/asr_chunk/asr_stop,中间结果实时回填,链路异常退回整段转写
- 图片选完先上屏再 OCR,识别原文以 format 消息并入对话
- 失败状态挂在原提问上可点击重试,401 静默重登后原样重发
- 消息区改为暖白纸面与头像+时间布局,常见问题与清空收进更多菜单
This commit is contained in:
lik
2026-11-18 22:34:17 +08:00
parent 8e508d6934
commit 6da802cff9
9 changed files with 1931 additions and 717 deletions
+1434 -170
View File
File diff suppressed because it is too large Load Diff
+4 -2
View File
@@ -1,9 +1,11 @@
{
"navigationBarTitleText": "AI助手",
"navigationBarBackgroundColor": "#ffffff",
"navigationBarBackgroundColor": "#FAF6F1",
"navigationBarTextStyle": "black",
"backgroundColor": "#ffffff",
"backgroundColor": "#FAF6F1",
"disableScroll": true,
"usingComponents": {
"t-icon": "tdesign-miniprogram/icon/icon",
"t-chat-markdown": "tdesign-miniprogram/chat-markdown/chat-markdown"
}
}
+198 -56
View File
@@ -1,75 +1,217 @@
<view class="chat-container">
<scroll-view class="message-list" scroll-y scroll-into-view="{{scrollToMessage}}" scroll-with-animation>
<view class="quick-questions" wx:if="{{messages.length === 0}}">
<view class="welcome-text">您好,我是您的AI助手,有什么可以帮您?</view>
<view class="quick-list">
<view class="quick-item" wx:for="{{quickQuestions}}" wx:key="*this" data-question="{{item}}" bindtap="onQuickQuestionTap">
{{item}}
<!-- 消息列表区域:页面唯一滚动容器 -->
<scroll-view
class="message-list"
scroll-y
scroll-into-view="{{scrollToMessage}}"
enhanced
show-scrollbar="{{false}}"
scroll-with-animation
>
<!-- 欢迎区:空会话时的落点 -->
<view class="welcome-area" wx:if="{{messages.length === 0}}">
<text class="welcome-title">陪诊助手</text>
<view class="question-heading"><text>您可以这样问</text><text class="question-heading-sub">点选即发送</text></view>
<view class="question-list">
<view
class="quick-item"
wx:for="{{quickQuestions}}"
wx:key="id"
bindtap="onQuickQuestionTap"
data-question="{{item.text}}"
hover-class="question-hover"
aria-role="button"
aria-label="{{item.text}}"
>
<view class="question-mark" aria-hidden="true">?</view>
<text>{{item.text}}</text>
<t-icon name="chevron-right" size="26rpx" color="#A8551F" />
</view>
</view>
<text class="welcome-note">AI 生成内容仅供参考,请以系统实际数据为准。</text>
</view>
<view class="message-item {{item.type}}" wx:for="{{messages}}" wx:key="id" id="msg-{{item.id}}">
<view class="avatar {{item.type}}-avatar">
<text class="avatar-text">{{item.type === 'user' ? '我' : 'AI'}}</text>
<!-- 消息:头像在上、气泡在下,时间紧跟头像右侧;用户消息整条靠右 -->
<view
class="message-item {{item.type}}"
wx:for="{{messages}}"
wx:key="id"
id="msg-{{item.id}}"
>
<!-- 连接或服务错误是系统状态,不使用头像 -->
<view wx:if="{{item.type === 'system'}}" class="system-message">
<text>{{item.content}}</text>
</view>
<block wx:else>
<view class="message-head">
<!-- AI:品牌线稿标记;用户:人像图标,身份只由图形区分 -->
<view wx:if="{{item.type === 'ai'}}" class="avatar">
<image class="avatar-img" src="/images/ai-ink.png" mode="aspectFit" />
</view>
<view wx:else class="avatar">
<t-icon name="user" size="30rpx" color="#6F655C" />
</view>
<text class="message-author">{{item.type === 'ai' ? 'AI助手' : '我'}}</text>
<text class="message-time" wx:if="{{item.showTime}}">{{item.time}}</text>
</view>
<view class="message-content">
<view class="message-bubble" wx:if="{{item.contentType !== 'questions'}}">
<t-chat-markdown
wx:if="{{item.type === 'ai' && item.contentType === 'text'}}"
class="message-markdown"
content="{{item.content}}"
/>
<text wx:elif="{{item.contentType === 'text'}}" class="message-text" user-select>{{item.content}}</text>
<image
wx:if="{{item.contentType === 'image' && item.content}}"
class="message-image"
src="{{item.content}}"
mode="widthFix"
bindtap="previewImage"
data-src="{{item.content}}"
/>
<!-- 历史里的图片不存临时路径(重启即失效),退化成一行占位 -->
<text wx:elif="{{item.contentType === 'image'}}" class="message-image-placeholder">[图片]</text>
</view>
<!-- 常见问题:把问题清单直接铺进会话流里,点一下即发送 -->
<view wx:else class="question-list">
<view
class="quick-item"
wx:for="{{item.content}}"
wx:for-item="question"
wx:key="id"
bindtap="onQuickQuestionTap"
data-question="{{question.text}}"
hover-class="question-hover"
aria-role="button"
aria-label="{{question.text}}"
>
<text>{{question.text}}</text>
<t-icon name="chevron-right" size="26rpx" color="#A8551F" />
</view>
</view>
<!-- AI 声明:本地问题清单和系统错误均不展示 -->
<text
wx:if="{{item.type === 'ai' && item.contentType !== 'questions'}}"
class="message-note"
>AI 生成,仅供参考</text>
<text
wx:if="{{item.type === 'user' && item.status === 'failed'}}"
class="message-retry"
bindtap="onRetryMessage"
data-id="{{item.id}}"
>发送失败,点击重试</text>
</view>
</block>
</view>
<!-- AI 正在输入:图片/语音识别期间也用它作为等待态 -->
<view class="message-item ai" wx:if="{{isTyping}}" id="msg-typing">
<view class="message-head">
<view class="avatar">
<image class="avatar-img" src="/images/ai-ink.png" mode="aspectFit" />
</view>
<text class="message-author">AI助手</text>
</view>
<view class="message-content">
<view class="message-bubble {{item.type}}-bubble">
<!-- subagent 消息:引用卡片样式,默认折叠 -->
<block wx:if="{{item.source === 'subagent'}}">
<view class="subagent-header" data-id="{{item.id}}" bindtap="toggleSubagent">
<text class="subagent-label">思考中...</text>
<text class="subagent-arrow {{expandedIds[item.id] ? 'expanded' : ''}}">▸</text>
</view>
<view class="subagent-body" wx:if="{{expandedIds[item.id]}}">
<t-chat-markdown class="message-markdown" content="{{item.content}}" />
</view>
</block>
<t-chat-markdown
wx:elif="{{item.contentType === 'text' && item.type === 'ai'}}"
class="message-markdown"
content="{{item.content}}"
/>
<text class="message-text" wx:elif="{{item.contentType === 'text'}}">{{item.content}}</text>
<view class="message-bubble typing-bubble">
<view class="typing-lines">
<text class="typing-text">{{isRecognizing ? '正在识别,请稍候' : '正在处理...' + processingSeconds + '秒'}}</text>
<!-- 后台进度:工具/子代理有动作时这行会变化,避免只剩一个计时器 -->
<text
class="typing-progress"
wx:if="{{!isRecognizing && progressLabel}}"
>{{progressLabel}}{{progressStep ? ' · 已完成 ' + progressStep + ' 步' : ''}}</text>
</view>
</view>
<text class="message-time" wx:if="{{item.time}}">{{item.time}}</text>
</view>
</view>
<view class="typing-indicator" wx:if="{{isTyping}}">
<view class="avatar ai-avatar">
<text class="avatar-text">AI</text>
</view>
<view class="typing-bubble">
<view class="dot"></view>
<view class="dot"></view>
<view class="dot"></view>
</view>
</view>
<!-- 底部留白,确保最新消息可见 -->
<view style="height: 40rpx;"></view>
</scroll-view>
<view class="chat-footer">
<view class="chat-toolbar" wx:if="{{messages.length > 0}}">
<view class="chat-toolbar-action" bindtap="clearChat">
<text>清空记录</text>
<!-- 语音状态:只在录音阶段显示,紧贴输入区上方 -->
<view class="voice-status" wx:if="{{recording}}">
<view class="voice-dot recording"></view>
<view class="voice-status-main">
<text class="voice-status-text">正在录音 {{recordTime}}</text>
<text class="voice-status-sub">{{voiceRealtimeOff ? '结束后整段转写' : '点麦克风或发送键发出'}}</text>
</view>
<view
class="voice-cancel"
bindtap="onCancelVoiceTap"
aria-role="button"
aria-label="取消语音输入"
>
<t-icon name="close" size="24rpx" color="#A8551F" />
<text>取消</text>
</view>
</view>
<!-- 输入面板:上方文字,下方输入方式与发送 -->
<view class="composer">
<view class="input-area">
<textarea
class="message-input {{recording || isRecognizing ? 'is-readonly' : ''}}"
value="{{inputValue}}"
placeholder="说说您的问题或需要…"
placeholder-class="input-placeholder"
auto-height
maxlength="-1"
cursor-spacing="24"
confirm-type="send"
disabled="{{recording || isRecognizing}}"
adjust-position="{{true}}"
hold-keyboard="{{true}}"
bindinput="onInputChange"
bindconfirm="sendMessage"
focus="{{inputFocus}}"
/>
</view>
<view class="composer-actions">
<view class="input-tools">
<view class="input-tool {{recording ? 'is-recording' : ''}}" bindtap="onMicTap" aria-role="button" aria-label="{{recording ? '结束并发送语音' : '语音输入'}}">
<t-icon name="microphone" size="34rpx" color="{{recording ? '#A8551F' : '#6F655C'}}" />
<text>{{recording ? '结束' : '语音'}}</text>
</view>
<view class="input-tool" bindtap="onImageTap" aria-role="button" aria-label="拍照或选择图片">
<t-icon name="image" size="34rpx" color="#6F655C" />
<text>图片</text>
</view>
<view class="input-tool {{showMoreMenu ? 'is-open' : ''}}" bindtap="toggleMoreMenu" aria-role="button" aria-label="更多功能" aria-expanded="{{showMoreMenu}}">
<view class="more-dots" aria-hidden="true">
<view class="more-dot"></view>
<view class="more-dot"></view>
<view class="more-dot"></view>
</view>
<text>更多</text>
</view>
</view>
<view
class="send-btn {{inputValue && !isRecognizing ? 'active' : ''}}"
bindtap="sendMessage"
aria-role="button"
aria-label="发送消息"
aria-disabled="{{!inputValue || isRecognizing}}"
>
<text>发送</text>
<t-icon name="chevron-right" size="30rpx" color="{{inputValue && !isRecognizing ? '#FFFFFF' : '#6F655C'}}" />
</view>
</view>
<view class="input-area">
<input
class="chat-input"
type="text"
placeholder="请输入您的问题..."
value="{{inputValue}}"
bindinput="onInputChange"
confirm-type="send"
bindconfirm="sendMessage"
adjust-position="{{true}}"
cursor-spacing="20"
hold-keyboard="{{true}}"
/>
<view class="send-btn {{canSend ? 'active' : ''}}" bindtap="sendMessage">
<text class="send-text">发送</text>
<!-- 更多菜单:向上展开,点遮罩关闭;清空仍走二次确认 -->
<view class="more-mask" wx:if="{{showMoreMenu}}" bindtap="onCloseMoreMenu" aria-hidden="true"></view>
<view class="more-menu" wx:if="{{showMoreMenu}}" aria-role="menu">
<view class="more-item" bindtap="onMoreQuickQuestions" aria-role="menuitem">
<t-icon name="help-circle" size="30rpx" color="#6F655C" />
<text class="more-item-text">常见问题</text>
</view>
<view class="more-divider" wx:if="{{messages.length}}"></view>
<view class="more-item more-item-muted" wx:if="{{messages.length}}" bindtap="onMoreClearChat" aria-role="menuitem">
<t-icon name="delete" size="30rpx" color="#6F655C" />
<text class="more-item-text">清空聊天记录</text>
</view>
</view>
</view>
+125 -375
View File
@@ -1,6 +1,25 @@
/* 与就诊人端 AI 页同源:暖白纸面、清晰左基线、克制的暖橙强调。
页面不滚动,唯一滚动容器是消息区;颜色令牌取自本项目 TDesign 主题色阶。 */
page {
background-color: #FAF6F1;
color: #2A211B;
--brand-strong: #C26A2E;
--brand-soft: #FCF3E9;
--brand-line: #EFCAA6;
--brand-ink: #A8551F;
--ink: #2A211B;
--ink-2: #4A4038;
--muted: #6F655C;
--line: #EAE1D6;
--paper: #FAF6F1;
--white: #FFFFFF;
--fs-24: 24rpx;
--fs-26: 26rpx;
--fs-28: 28rpx;
--fs-30: 30rpx;
--shadow-card: 0 2rpx 10rpx rgba(63, 43, 25, 0.07);
background-color: var(--paper);
color: var(--ink);
font-size: var(--fs-28);
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
@@ -8,389 +27,120 @@ page {
display: flex;
flex-direction: column;
height: 100vh;
background-color: #FAF6F1;
}
.chat-header {
display: flex;
align-items: center;
justify-content: space-between;
height: 88rpx;
padding: 0 24rpx;
background-color: #ffffff;
border-bottom: 1rpx solid #EAE1D6;
flex-shrink: 0;
}
.chat-header-title {
font-size: 30rpx;
font-weight: 600;
color: #2A211B;
}
.message-list {
flex: 1;
padding: 20rpx;
padding-bottom: 200rpx;
box-sizing: border-box;
overflow: hidden;
background: var(--paper);
}
.quick-questions {
display: flex;
flex-direction: column;
align-items: center;
padding: 40rpx 20rpx;
}
.message-list { flex: 1; height: 0; min-height: 0; box-sizing: border-box; }
.welcome-area { padding: 32rpx 32rpx 24rpx; }
.welcome-title { display: block; color: var(--ink); font-size: 44rpx; font-weight: 600; line-height: 1.45; }
.question-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12rpx; margin: 32rpx 0 16rpx; color: var(--ink); font-size: var(--fs-28); font-weight: 500; }
.question-heading-sub { color: var(--muted); font-size: var(--fs-24); font-weight: 400; }
.question-list { display: flex; flex-direction: column; gap: 12rpx; width: 100%; box-sizing: border-box; }
.quick-item { display: flex; align-items: center; justify-content: space-between; gap: 16rpx; min-height: 96rpx; box-sizing: border-box; padding: 20rpx; border: 2rpx solid var(--line); border-radius: 20rpx; background: var(--white); color: var(--ink-2); font-size: var(--fs-28); line-height: 1.6; }
.quick-item > text { flex: 1; min-width: 0; word-break: break-all; }
.question-mark { display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 40rpx; height: 40rpx; border-radius: 12rpx; background: var(--paper); color: var(--brand-ink); font-size: var(--fs-26); }
.quick-item.question-hover, .quick-item:active { background: var(--brand-soft); border-color: var(--brand-line); }
.welcome-note { display: block; margin-top: 20rpx; color: var(--muted); font-size: var(--fs-24); line-height: 1.7; }
.welcome-text {
font-size: 32rpx;
color: #2A211B;
margin-bottom: 40rpx;
text-align: center;
font-weight: 500;
}
.quick-list {
display: flex;
flex-direction: column;
width: 100%;
gap: 20rpx;
}
.quick-item {
background-color: #ffffff;
border-radius: 24rpx;
padding: 24rpx 32rpx;
font-size: 28rpx;
color: #C26A2E;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
text-align: center;
border: 1rpx solid #EAE1D6;
transition: all 0.2s ease;
}
.quick-item:active {
transform: scale(0.98);
background-color: rgba(194, 106, 46, 0.05);
}
.message-item {
display: flex;
flex-direction: column;
margin-bottom: 32rpx;
}
.message-item.ai {
align-items: flex-start;
}
.message-item.user {
align-items: flex-end;
}
.message-time {
font-size: 24rpx;
color: #A3988B;
margin-top: 8rpx;
padding: 0 4rpx;
}
.message-item.ai .message-time {
text-align: left;
align-self: flex-start;
}
.message-item.user .message-time {
text-align: right;
align-self: flex-end;
}
.avatar {
width: 64rpx;
height: 64rpx;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
margin-bottom: 12rpx;
}
.user-avatar {
background: #C26A2E;
box-shadow: 0 4rpx 12rpx rgba(180, 85, 42, 0.25);
}
.ai-avatar {
background: #B4552A;
box-shadow: 0 4rpx 12rpx rgba(217, 134, 52, 0.25);
}
.avatar-text {
color: #fff;
font-size: 28rpx;
font-weight: 500;
}
.message-content {
display: flex;
flex-direction: column;
max-width: 95%;
}
.message-item.user .message-content {
align-items: flex-end;
}
.message-item.ai .message-content {
align-items: flex-start;
}
.message-bubble {
padding: 20rpx 24rpx;
border-radius: 16rpx;
font-size: 28rpx;
line-height: 1.6;
word-break: break-word;
max-width: 100%;
}
.user-bubble {
background: #C26A2E;
color: #fff;
border-bottom-right-radius: 4rpx;
box-shadow: 0 4rpx 12rpx rgba(180, 85, 42, 0.2);
margin-right: 4rpx;
}
.ai-bubble {
background-color: #ffffff;
color: #2A211B;
border-bottom-left-radius: 4rpx;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
border: 1rpx solid #EAE1D6;
margin-left: 4rpx;
}
/* Markdown 渲染区域 */
/* 对话正文占据主要宽度,避免头像左右分栏挤压长回答和报告表格 */
.message-item { display: flex; flex-direction: column; padding: 20rpx 32rpx; }
.message-item.user { align-items: flex-end; }
.message-head { display: flex; align-items: center; gap: 10rpx; margin-bottom: 12rpx; }
.message-item.user .message-head { flex-direction: row-reverse; }
.avatar { display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 44rpx; height: 44rpx; border-radius: 14rpx; background: var(--white); border: 2rpx solid var(--line); }
.avatar-img { width: 30rpx; height: 30rpx; }
.message-item.user .avatar { background: transparent; border-color: transparent; }
.message-author { color: var(--ink-2); font-size: var(--fs-24); font-weight: 500; }
.message-time { color: var(--muted); font-size: var(--fs-24); margin: 0 6rpx; }
.message-content { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; max-width: 100%; }
.message-item.ai .message-content { width: 100%; }
.message-item.user .message-content { align-items: flex-end; max-width: 90%; }
.message-bubble { box-sizing: border-box; min-width: 0; max-width: 100%; padding: 24rpx; border-radius: 24rpx; word-wrap: break-word; word-break: break-word; }
.message-item.ai .message-bubble { width: 100%; border: 2rpx solid var(--line); border-top-left-radius: 8rpx; background: var(--white); }
.message-item.user .message-bubble { border: 2rpx solid var(--brand-line); border-top-right-radius: 8rpx; background: var(--brand-soft); }
.message-text { font-size: var(--fs-30); line-height: 1.75; white-space: pre-wrap; color: var(--ink-2); word-break: break-word; }
.message-item.user .message-text { color: var(--brand-ink); }
.message-image { display: block; width: 400rpx; max-width: 100%; border-radius: 16rpx; }
.message-image-placeholder { font-size: var(--fs-28); color: var(--muted); line-height: 1.6; }
.message-note { margin-top: 10rpx; color: var(--muted); font-size: var(--fs-24); line-height: 1.6; }
.message-retry { display: flex; align-items: center; min-height: 88rpx; color: var(--brand-ink); font-size: var(--fs-26); }
.message-item.system { align-items: center; }
.system-message { max-width: 100%; padding: 8rpx 16rpx; color: var(--muted); font-size: var(--fs-26); line-height: 1.7; text-align: center; }
.message-markdown {
display: block;
width: 100%;
font-size: 28rpx;
color: #2A211B;
line-height: 1.6;
min-width: 0;
font-size: var(--fs-30);
line-height: 1.75;
color: var(--ink-2);
/* 组件内的色彩通过实际消费的 TDesign 变量传入,不依赖跨组件选择器 */
--td-text-color-primary: var(--ink-2);
--td-bg-color-component: var(--brand-soft);
--td-bg-color-page: var(--paper);
--td-bg-color-secondarycontainer: var(--paper);
--td-component-border: var(--line);
}
/* 表格样式覆盖(防止过宽) */
.message-markdown .t-chat-markdown-table {
width: 100%;
max-width: 100%;
overflow-x: auto;
-webkit-overflow-scrolling: touch;
border: 1rpx solid #EAE1D6;
border-radius: 8rpx;
}
.message-markdown .t-chat-markdown-table__container {
display: table;
min-width: 100%;
max-width: max-content;
border-collapse: collapse;
white-space: normal;
table-layout: fixed;
word-break: break-word;
}
.message-markdown .t-chat-markdown-table { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 2rpx solid var(--line); border-radius: 12rpx; }
.message-markdown .t-chat-markdown-table__container { display: table; min-width: 100%; border-collapse: collapse; }
.message-markdown .t-chat-markdown-table__container-th,
.message-markdown .t-chat-markdown-table__container-td { padding: 12rpx; font-size: var(--fs-26); line-height: 1.6; word-break: break-word; }
.message-markdown .t-chat-markdown-table__container-th { background: var(--brand-soft); color: var(--ink); }
.message-markdown .t-chat-markdown-table__container-tr:nth-child(2n) { background: var(--paper); }
/* 兼容表格子组件的另一套类名 */
.message-markdown .t-chat-markdown-table__th,
.message-markdown .t-chat-markdown-table__td {
padding: 8rpx 12rpx;
font-size: 26rpx;
line-height: 1.4;
white-space: normal;
word-break: break-word;
word-wrap: break-word;
overflow-wrap: break-word;
max-width: 320rpx;
}
.message-markdown .t-chat-markdown-table__td { padding: 12rpx; font-size: var(--fs-26); line-height: 1.6; white-space: normal; word-break: break-word; }
.message-markdown .t-chat-markdown-table__th { background: var(--brand-soft); color: var(--ink); }
.message-markdown .t-chat-markdown-table__tr:nth-child(2n) { background: var(--paper); }
.message-markdown .t-chat-markdown-code, .message-markdown .t-chat-markdown-codespan { font-size: var(--fs-26); word-break: break-all; }
.message-item.ai .typing-bubble { display: flex; align-items: center; width: auto; min-height: 88rpx; }
.typing-lines { display: flex; flex-direction: column; gap: 2rpx; }
.typing-text { font-size: var(--fs-26); color: var(--muted); line-height: 1.6; }
.typing-progress { font-size: 22rpx; color: var(--muted); line-height: 1.5; opacity: 0.85; }
.message-markdown .t-chat-markdown-table__th {
background-color: #FAF6F1;
font-weight: 600;
color: #2A211B;
}
/* 统一白色输入面板:文字在上,更多与发送在下,所有操作横向展开。
position: relative 供「更多」菜单定位(菜单从按钮上方展开) */
.composer { position: relative; flex-shrink: 0; margin: 12rpx 24rpx 8rpx; padding: 20rpx 20rpx 12rpx; border: 2rpx solid var(--line); border-radius: 28rpx; background: var(--white); box-shadow: var(--shadow-card); }
.input-area { padding: 0 4rpx; }
.message-input { display: block; box-sizing: border-box; width: 100%; min-height: 76rpx; max-height: 180rpx; padding: 4rpx 0 12rpx; color: var(--ink); font-size: var(--fs-30); line-height: 1.6; background: transparent; }
.message-input.is-readonly { color: var(--muted); }
.input-placeholder { color: var(--muted); font-size: var(--fs-28); }
.composer-actions { display: flex; align-items: center; justify-content: space-between; gap: 16rpx; }
.input-tools { display: flex; align-items: center; gap: 8rpx; }
.input-tool { display: flex; align-items: center; justify-content: center; gap: 8rpx; box-sizing: border-box; min-width: 104rpx; min-height: 88rpx; padding: 12rpx; border-radius: 16rpx; color: var(--muted); font-size: var(--fs-24); }
.input-tool.is-open { color: var(--brand-ink); background: var(--brand-soft); }
.input-tool.is-recording { color: var(--brand-ink); background: var(--brand-soft); }
.input-tool:active { background: var(--paper); }
/* 三个点用 CSS 画,不依赖图标名;与文字同一条基线 */
.more-dots { display: flex; align-items: center; justify-content: center; gap: 5rpx; width: 34rpx; height: 34rpx; }
.more-dot { width: 8rpx; height: 8rpx; border-radius: 50%; background: var(--muted); }
.input-tool.is-open .more-dot { background: var(--brand-ink); }
.send-btn { display: flex; align-items: center; justify-content: center; flex-shrink: 0; gap: 10rpx; box-sizing: border-box; min-width: 136rpx; min-height: 88rpx; padding: 16rpx 20rpx; border-radius: 20rpx; background: var(--paper); color: var(--muted); font-size: var(--fs-28); font-weight: 500; }
.send-btn.active { background: var(--brand-strong); color: var(--white); }
.send-btn.active:active { background: var(--brand-ink); }
.message-markdown .t-chat-markdown-table__tr:nth-child(2n) {
background-color: #FCFAF7;
}
/* ===== 「更多」菜单 =====
透明遮罩负责点外部关闭;菜单锚在输入面板上方左侧,向上展开 */
.more-mask { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 120; background: transparent; }
.more-menu { position: absolute; left: 20rpx; bottom: calc(100% + 8rpx); z-index: 121; box-sizing: border-box; min-width: 320rpx; padding: 8rpx 0; border: 2rpx solid var(--line); border-radius: 20rpx; background: var(--white); box-shadow: var(--shadow-card); animation: more-menu-in 0.16s ease-out; }
@keyframes more-menu-in { from { opacity: 0; transform: translateY(8rpx); } to { opacity: 1; transform: translateY(0); } }
.more-item { display: flex; align-items: center; gap: 14rpx; box-sizing: border-box; min-height: 88rpx; padding: 0 24rpx; color: var(--ink-2); font-size: var(--fs-28); line-height: 1.4; }
.more-item:active { background: var(--brand-soft); }
.more-item-muted { color: var(--muted); }
.more-divider { height: 2rpx; margin: 0 20rpx; background: var(--line); }
/* 代码块样式覆盖 */
.message-markdown .t-chat-markdown-codespan,
.message-markdown .t-chat-markdown-code {
font-size: 26rpx;
word-break: break-all;
}
/* subagent 引用卡片(默认折叠) */
.subagent-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 4rpx 0;
}
.subagent-label {
font-size: 26rpx;
color: #6F655C;
}
.subagent-arrow {
font-size: 26rpx;
color: #A3988B;
transition: transform 0.2s ease;
}
.subagent-arrow.expanded {
transform: rotate(90deg);
}
.subagent-body {
margin-top: 12rpx;
padding-top: 12rpx;
border-top: 1rpx solid #EAE1D6;
}
.typing-indicator {
display: flex;
flex-direction: column;
align-items: flex-start;
margin-bottom: 32rpx;
}
.typing-bubble {
display: flex;
align-items: center;
gap: 12rpx;
background-color: #ffffff;
padding: 24rpx 32rpx;
border-radius: 16rpx;
border-bottom-left-radius: 4rpx;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04);
border: 1rpx solid #EAE1D6;
}
.dot {
width: 16rpx;
height: 16rpx;
background-color: #A3988B;
border-radius: 50%;
animation: bounce 1.4s infinite ease-in-out both;
}
.dot:nth-child(1) {
animation-delay: -0.32s;
}
.dot:nth-child(2) {
animation-delay: -0.16s;
}
@keyframes bounce {
0%, 80%, 100% {
transform: scale(0.6);
}
40% {
transform: scale(1);
}
}
.input-area {
display: flex;
align-items: center;
padding: 20rpx 24rpx;
background-color: #ffffff;
gap: 16rpx;
box-sizing: border-box;
}
.chat-footer {
position: fixed;
left: 0;
right: 0;
bottom: 0;
z-index: 10;
background-color: #ffffff;
}
.chat-toolbar {
display: flex;
align-items: right;
justify-content: right;
padding: 12rpx 24rpx;
background-color: #FAF6F1;
border-top: 1rpx solid #EAE1D6;
border-bottom: 1rpx solid #EAE1D6;
}
.chat-toolbar-action {
display: flex;
align-items: right;
justify-content: right;
padding: 6rpx 24rpx;
border-radius: 24rpx;
background-color: #ffffff;
border: 1rpx solid #EAE1D6;
transition: all 0.2s ease;
}
.chat-toolbar-action:active {
transform: scale(0.96);
background-color: rgba(194, 106, 46, 0.08);
border-color: #C26A2E;
}
.chat-toolbar-action text {
font-size: 26rpx;
color: #6F655C;
}
.chat-input {
flex: 1;
height: 72rpx;
background-color: #FAF6F1;
border-radius: 36rpx;
padding: 0 28rpx;
font-size: 28rpx;
color: #2A211B;
border: 1rpx solid #EAE1D6;
}
.chat-input::placeholder {
color: #A3988B;
}
.send-btn {
width: 120rpx;
height: 72rpx;
background-color: #EAE1D6;
border-radius: 36rpx;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s ease;
}
.send-btn.active {
background: #C26A2E;
box-shadow: 0 4rpx 12rpx rgba(180, 85, 42, 0.25);
}
.send-text {
color: #A3988B;
font-size: 28rpx;
font-weight: 500;
transition: color 0.2s ease;
}
.send-btn.active .send-text {
color: #FFFFFF;
/* 语音状态条:只在录音阶段显示,紧贴输入区上方 */
.voice-status { display: flex; align-items: center; flex-shrink: 0; gap: 16rpx; margin: 8rpx 24rpx 0; padding: 8rpx 16rpx; border: 2rpx solid var(--brand-line); border-radius: 20rpx; background: var(--brand-soft); }
.voice-dot { flex-shrink: 0; width: 12rpx; height: 12rpx; border-radius: 50%; background: var(--brand-strong); }
.voice-dot.recording { animation: record-pulse 1.2s infinite ease-in-out; }
.voice-status-main { display: flex; flex: 1; flex-direction: column; gap: 4rpx; min-width: 0; }
.voice-status-text { font-size: var(--fs-26); font-weight: 500; color: var(--ink-2); line-height: 1.5; }
.voice-status-sub { font-size: var(--fs-24); color: var(--muted); line-height: 1.5; }
.voice-cancel { display: flex; align-items: center; justify-content: center; flex-shrink: 0; gap: 8rpx; min-width: 88rpx; min-height: 88rpx; padding: 0 8rpx; color: var(--brand-ink); font-size: var(--fs-26); }
@keyframes record-pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .voice-dot.recording, .more-menu { animation: none; transition: none; } }
@media (max-width: 340px) {
.input-tool { min-width: 88rpx; padding: 8rpx; }
.composer-actions { gap: 8rpx; }
}