fix: Chat Analysis

This commit is contained in:
Jason
2026-05-17 21:32:31 +08:00
parent 1df4f0e523
commit a300d3c5d3
4 changed files with 51 additions and 13 deletions

View File

@@ -259,7 +259,7 @@ function callApi(
}
const body = JSON.stringify(payload)
const options = {
const requestOptions = {
hostname: urlObj.hostname,
port: urlObj.port || (urlObj.protocol === 'https:' ? 443 : 80),
path: urlObj.pathname + urlObj.search,
@@ -273,7 +273,7 @@ function callApi(
const isHttps = urlObj.protocol === 'https:'
const requestFn = isHttps ? https.request : http.request
const req = requestFn(options, (res) => {
const req = requestFn(requestOptions, (res) => {
let data = ''
res.on('data', (chunk) => { data += chunk })
res.on('end', () => {

View File

@@ -101,13 +101,13 @@ function ChatMessageBubble({
{actionNode}
</div>
)}
{!isGroupChat && !isSent && actionNode ? (
<div className="message-action-floating">
{actionNode}
</div>
) : null}
{children}
</div>
{!isGroupChat && !isSent && actionNode ? (
<div className="message-action-inline">
{actionNode}
</div>
) : null}
</div>
{isSelectionMode && isSent && <SelectionCheckbox checked={isSelected} side="right" />}

View File

@@ -5846,12 +5846,14 @@
}
}
.message-action-floating {
height: 18px;
margin: 0 0 3px 12px;
.message-action-inline {
width: 24px;
height: 24px;
margin: 6px 0 0 4px;
display: flex;
align-items: center;
justify-content: flex-start;
flex-shrink: 0;
}
.message-insight-trigger {
@@ -5880,6 +5882,22 @@
color: var(--primary);
background: color-mix(in srgb, var(--primary) 10%, transparent);
}
&.compact {
width: 24px;
height: 24px;
padding: 0;
justify-content: center;
border-radius: 50%;
color: var(--primary);
background: transparent;
transform: none;
svg {
width: 14px;
height: 14px;
}
}
}
.message-wrapper-with-selection:hover .message-insight-trigger,
@@ -5887,6 +5905,16 @@
opacity: 0.78;
}
.message-wrapper-with-selection:hover .message-insight-trigger.compact,
.message-insight-trigger.compact:focus-visible {
opacity: 0.72;
}
.message-insight-trigger.compact:hover {
opacity: 1;
background: color-mix(in srgb, var(--primary) 10%, transparent);
}
.message-insight-trigger:focus-visible {
outline: 2px solid color-mix(in srgb, var(--primary) 42%, transparent);
outline-offset: 2px;

View File

@@ -8640,7 +8640,8 @@ function MessageInsightControl({
avatarUrl,
senderName,
targetText,
contextCount
contextCount,
compact
}: {
message: Message
messageKey: string
@@ -8650,6 +8651,7 @@ function MessageInsightControl({
senderName?: string
targetText: string
contextCount: number
compact?: boolean
}) {
const anchorRef = useRef<HTMLButtonElement | null>(null)
const cardRef = useRef<HTMLDivElement | null>(null)
@@ -8798,9 +8800,16 @@ function MessageInsightControl({
return (
<>
<button ref={anchorRef} type="button" className="message-insight-trigger" onClick={handleOpen} title="深度解析">
<button
ref={anchorRef}
type="button"
className={`message-insight-trigger ${compact ? 'compact' : ''}`}
onClick={handleOpen}
title="深度解析"
aria-label="深度解析"
>
<Star size={12} />
<span></span>
{!compact && <span></span>}
</button>
{card}
</>
@@ -10085,6 +10094,7 @@ function MessageBubble({
senderName={resolvedSenderName || session.displayName || session.username}
targetText={cleanedParsedContent}
contextCount={aiMessageInsightContextCount || 50}
compact={!isGroupChat}
/>
) : null