mirror of
https://github.com/aaif-goose/goose.git
synced 2026-07-03 14:10:03 +02:00
more ui summary
This commit is contained in:
@@ -201,7 +201,7 @@ export default function ProgressiveMessageList({
|
||||
{isUser ? (
|
||||
<>
|
||||
{hasCompactionMarker && hasCompactionMarker(message) ? (
|
||||
<CompactionMarker message={message} />
|
||||
<CompactionMarker message={message} messages={messages} />
|
||||
) : (
|
||||
!hasOnlyToolResponses(message) && (
|
||||
<UserMessage
|
||||
@@ -216,7 +216,7 @@ export default function ProgressiveMessageList({
|
||||
) : (
|
||||
<>
|
||||
{hasCompactionMarker && hasCompactionMarker(message) ? (
|
||||
<CompactionMarker message={message} />
|
||||
<CompactionMarker message={message} messages={messages} />
|
||||
) : (
|
||||
<GooseMessage
|
||||
sessionId={chat.sessionId}
|
||||
|
||||
@@ -50,15 +50,25 @@ export const SummaryViewModal: React.FC<SummaryViewModalProps> = ({
|
||||
}
|
||||
|
||||
// Fallback: Look for agent-visible but not user-visible messages (actual summary)
|
||||
// Skip messages that contain the "summary that was prepared" text
|
||||
for (let i = messages.length - 1; i >= 0; i--) {
|
||||
const msg = messages[i];
|
||||
if (msg.metadata?.agentVisible === true && msg.metadata?.userVisible === false) {
|
||||
// Check if it contains text that looks like a summary
|
||||
// Check if it contains text content
|
||||
const textContent = msg.content.find((c) => c.type === 'text');
|
||||
if (textContent && 'text' in textContent && textContent.text.includes('summary')) {
|
||||
if (textContent && 'text' in textContent) {
|
||||
const text = textContent.text;
|
||||
// Skip the "summary that was prepared" message
|
||||
if (
|
||||
text.includes('summary that was prepared') ||
|
||||
text.includes('Do not mention that you read a summary')
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
// This should be the actual summary
|
||||
return {
|
||||
message: msg,
|
||||
content: textContent.text,
|
||||
content: text,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,12 +53,22 @@ export const AlertBox = ({ alert, className, messages }: AlertBoxProps) => {
|
||||
}
|
||||
|
||||
// Fallback: Look for agent-visible but not user-visible messages (actual summary)
|
||||
// Skip messages that contain the "summary that was prepared" text
|
||||
for (let i = messages.length - 1; i >= 0; i--) {
|
||||
const msg = messages[i];
|
||||
if (msg.metadata?.agentVisible === true && msg.metadata?.userVisible === false) {
|
||||
// Check if it contains text that looks like a summary
|
||||
// Check if it contains text content
|
||||
const textContent = msg.content.find((c) => c.type === 'text');
|
||||
if (textContent && 'text' in textContent && textContent.text.includes('summary')) {
|
||||
if (textContent && 'text' in textContent) {
|
||||
const text = textContent.text;
|
||||
// Skip the "summary that was prepared" message
|
||||
if (
|
||||
text.includes('summary that was prepared') ||
|
||||
text.includes('Do not mention that you read a summary')
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
// If we found text that doesn't match the skip patterns, it's likely a summary
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,10 @@ import SummaryViewModal from '../SummaryViewModal';
|
||||
|
||||
interface CompactionMarkerProps {
|
||||
message: Message;
|
||||
messages?: Message[];
|
||||
}
|
||||
|
||||
export const CompactionMarker: React.FC<CompactionMarkerProps> = ({ message }) => {
|
||||
export const CompactionMarker: React.FC<CompactionMarkerProps> = ({ message, messages }) => {
|
||||
const [showSummaryModal, setShowSummaryModal] = useState(false);
|
||||
|
||||
const compactionContent = message.content.find(
|
||||
@@ -32,11 +33,12 @@ export const CompactionMarker: React.FC<CompactionMarkerProps> = ({ message }) =
|
||||
View Summary
|
||||
</Button>
|
||||
)}
|
||||
{showSummaryModal && summaryText && (
|
||||
{showSummaryModal && (
|
||||
<SummaryViewModal
|
||||
isOpen={showSummaryModal}
|
||||
onClose={() => setShowSummaryModal(false)}
|
||||
summaryText={summaryText}
|
||||
messages={messages}
|
||||
summaryText={summaryText || undefined}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user