diff --git a/apps/android/src/screens/chat/messages.tsx b/apps/android/src/screens/chat/messages.tsx
index 6b04ee8..edfa9db 100644
--- a/apps/android/src/screens/chat/messages.tsx
+++ b/apps/android/src/screens/chat/messages.tsx
@@ -4,7 +4,7 @@ import { ArrowUp, Bot, Check, CircleCheck, ChevronDown, ChevronRight, ChevronUp,
import { memo, useEffect, useMemo, useRef, useState } from 'react'
import {
AccessibilityInfo,
- Alert,
+ ActivityIndicator,
Animated,
Modal,
Pressable,
@@ -15,8 +15,9 @@ import {
useWindowDimensions,
View,
} from 'react-native'
+import { Alert } from '../../ui/alert'
import * as Clipboard from 'expo-clipboard'
-import * as Haptics from 'expo-haptics'
+import { triggerLightHaptic } from '../../ui/haptics'
import Svg, { Path } from 'react-native-svg'
import { strings as zhCN } from '../../locales/i18n'
import { foldHistory, hasVisibleMessageText } from '../../state/event-reducer'
@@ -40,6 +41,7 @@ import { parseMessageQuotes, QuoteMarkIcon, QuotePreview } from '../../ui/quote-
import { PresentedFileGroup } from '../../ui/file-card'
import { useTheme } from '../../ui/theme-context'
import { useThemedStyles } from '../../ui/use-themed-styles'
+import { DARK_CODE_PALETTE, highlightCode, LIGHT_CODE_PALETTE } from '../../ui/syntax-highlight'
import { parseBotReplyPayload } from '../bot/replies'
import { BotReplies } from '../bot/reply-view'
import type { BotObject } from '../../services/bot-catalog'
@@ -216,19 +218,19 @@ export const ChatActivityGroup = memo(function ChatActivityGroup({ items, closed
setOpen(value => !value)}
- hitSlop={dense ? { top: 6, bottom: 6 } : undefined}
+ hitSlop={{ top: 7, bottom: 7 }}
style={({ pressed }) => [styles.processHeader, dense && { minHeight: 32 }, pressed && styles.reasoningHeaderPressed]}>
-
+
{label}
- {expanded ? : }
+ {expanded ? : }
{(latestTool !== undefined || running) && !expanded &&
{latestTool === undefined || (!closed && latestTool.state === 'running')
?
- : latestTool.state === 'failed' ? : }
+ : latestTool.state === 'failed' ? : }
{latestTool ? toolDisplayName(latestTool) : labels.thinking.running}{detail ? ` · ${detail}` : ''}
}
- {expanded && { if (running || pending) body.current?.scrollToEnd({ animated: false }) }}
contentContainerStyle={styles.processBody}>
@@ -338,7 +340,7 @@ function MessageBubble({ item, compact, artifacts, editedFiles, onFilePress, onS
onFilePress?: (path: string) => void
onSendPrompt?: (text: string) => Promise
}) {
- const { colors } = useTheme()
+ const { colors, appearance } = useTheme()
const styles = useThemedStyles(createStyles)
const user = item.role === 'user'
const remote = item.role === 'assistant'
@@ -376,26 +378,47 @@ function MessageBubble({ item, compact, artifacts, editedFiles, onFilePress, onS
const status = item.sendError ?? (item.sendState === 'failed' ? zhCN.chat.sendFailed : zhCN.chat.sendUnconfirmed)
const heartbeatBody = heartbeatMessageBody(item.text, 'user')
const { quotes, body } = parseMessageQuotes(item.text)
+ const hasBubbleText = heartbeatBody !== undefined || quotes.length > 0 || hasVisibleMessageText(body)
+ const solidText = colors.onPrimary ?? colors.white
+ const isSolid = !userBubble && appearance.bubbleStyle === 'solid'
const bubblePalette = { ...colors, ink: colors.onInverse, muted: colors.onInverse, subtle: colors.onInverse, surfaceStrong: colors.inverse }
+ const solidPalette = { ...colors, ink: solidText, muted: solidText, subtle: solidText, primary: solidText, surfaceStrong: 'rgba(255,255,255,0.18)' }
+ const softBubblePalette = { ...colors, surfaceStrong: colors.border }
+ const userBubbleStyle = userBubble
+ ? styles.userBubble
+ : !hasBubbleText
+ ? styles.userMediaOnly
+ : appearance.bubbleStyle === 'tinted'
+ ? styles.userTintedBubble
+ : appearance.bubbleStyle === 'solid'
+ ? styles.userSolidBubble
+ : appearance.bubbleStyle === 'minimal'
+ ? styles.userMinimalBubble
+ : styles.userSoftBubble
+ const quoteTint = userBubble ? colors.onInverse : isSolid ? solidText : colors.primary
return
-
+
{showImages && }
{heartbeatBody !== undefined ? : quotes.length > 0 ? (
{quotes.map((quoteText, index) => (
-
-
+
+
“{formatQuoteDraftSnippet(quoteText, 16)}”
))}
{hasVisibleMessageText(body) && (
- {body}
+ {body}
)}
) : (
- hasVisibleMessageText(body) &&
+ hasVisibleMessageText(body) && (
+
+
+
+ )
)}
{item.sendState === 'canceled'
@@ -441,16 +464,19 @@ function ReasoningDisclosure({ item }: { item: ChatMessage }) {
accessibilityRole="button"
accessibilityLabel={`${actionLabel}。${preview}`}
accessibilityState={{ expanded }}
+ hitSlop={{ top: 7, bottom: 7 }}
onPress={() => setExpanded(value => !value)}
style={({ pressed }) => [styles.reasoningHeader, pressed && styles.reasoningHeaderPressed]}
>
-
+
+
+
{label}
·
{preview}
{expanded
- ?
- : }
+ ?
+ : }
{expanded && }
@@ -496,11 +522,11 @@ function ToolRow({ item: original, compact }: { item: ToolActivity; compact: boo
>
{item.toolName === 'todo_write' || (item.toolKey ?? '').endsWith('todo_write') ? (
-
+
) : /command|bash|shell|命令|终端/i.test(item.toolName) ? (
-
+
) : (
-
+
)}
@@ -508,10 +534,13 @@ function ToolRow({ item: original, compact }: { item: ToolActivity; compact: boo
{detail !== undefined && ·}
{detail !== undefined && {detail}}
+ {item.state === 'running' && (
+
+ )}
{item.state === 'failed' && {stateText}}
{hasDetail && (expanded
- ?
- : )}
+ ?
+ : )}
{item.images !== undefined && item.images.length > 0 && }
{expanded && hasDetail && (
@@ -536,14 +565,33 @@ export function ChatImages({ images, alignEnd = false, tool = false }: { images:
}
function ToolDetailView({ label, detail }: { label: string; detail: ToolDisplayDetail }) {
- const { colors } = useTheme()
+ const { scheme, appearance } = useTheme()
const styles = useThemedStyles(createStyles)
+ const useDarkCode = appearance.codeTheme === 'dark' || (appearance.codeTheme === 'auto' && scheme === 'dark')
+ const palette = useDarkCode ? DARK_CODE_PALETTE : LIGHT_CODE_PALETTE
+ const trimmed = detail.text.trimStart()
+ const likelyJson = detail.format !== 'markdown' && (trimmed.startsWith('{') || trimmed.startsWith('['))
+ const tokens = useMemo(
+ () => (detail.format === 'markdown' ? [] : highlightCode(detail.text, likelyJson ? 'json' : undefined)),
+ [detail.format, detail.text, likelyJson],
+ )
return (
{label}
{detail.format === 'markdown'
?
- : {detail.text}}
+ : (
+
+ {tokens.map((token, index) => (
+ token.kind === 'plain'
+ ? token.text
+ : {token.text}
+ ))}
+
+ )}
{detail.truncated && {zhCN.chat.toolTruncated}}
)
@@ -714,7 +762,10 @@ export function QueueDock({ items }: { items: { id?: string; rpcId?: string; pre
void useAppStore.getState().updateQueueItem(item.id!, 'steer', item.rpcId)} />
void useAppStore.getState().updateQueueItem(item.id!, 'remove', item.rpcId)} />
+ onPress={() => {
+ triggerLightHaptic()
+ void useAppStore.getState().updateQueueItem(item.id!, 'remove', item.rpcId)
+ }} />
>}
))}
@@ -722,7 +773,26 @@ export function QueueDock({ items }: { items: { id?: string; rpcId?: string; pre
)
}
-export function WelcomeMessage() {
+export function ReplyStatusBanner({ label, stopping }: { label: string; stopping: boolean }) {
+ const { colors } = useTheme()
+ const styles = useThemedStyles(createStyles)
+ return (
+
+
+ {label}
+ {!stopping && }
+
+ )
+}
+
+export function WelcomeMessage({ policyHint }: { policyHint?: string } = {}) {
const { colors } = useTheme()
const styles = useThemedStyles(createStyles)
return (
@@ -740,6 +810,9 @@ export function WelcomeMessage() {
{zhCN.chat.welcomeBadge}
+ {policyHint !== undefined && policyHint.length > 0 && (
+ {policyHint}
+ )}
)
}