mirror of
https://github.com/enricoros/big-AGI.git
synced 2026-05-10 21:50:14 -07:00
AI Inspector: compress intermediate large string fields
This commit is contained in:
@@ -7,6 +7,7 @@ import { Box, Card, Chip, Divider, Sheet, Typography } from '@mui/joy';
|
|||||||
import { RenderCodeMemo } from '~/modules/blocks/code/RenderCode';
|
import { RenderCodeMemo } from '~/modules/blocks/code/RenderCode';
|
||||||
|
|
||||||
import { ExpanderControlledBox } from '~/common/components/ExpanderControlledBox';
|
import { ExpanderControlledBox } from '~/common/components/ExpanderControlledBox';
|
||||||
|
import { objectDeepCloneWithStringLimit } from '~/common/util/objectUtils';
|
||||||
import TimelapseIcon from '@mui/icons-material/Timelapse';
|
import TimelapseIcon from '@mui/icons-material/Timelapse';
|
||||||
|
|
||||||
import type { AixClientDebugger } from './memstore-aix-client-debugger';
|
import type { AixClientDebugger } from './memstore-aix-client-debugger';
|
||||||
@@ -184,12 +185,10 @@ export function AixDebuggerFrame(props: {
|
|||||||
{/* List of particles */}
|
{/* List of particles */}
|
||||||
{frame.particles.map((particle, idx) => {
|
{frame.particles.map((particle, idx) => {
|
||||||
|
|
||||||
// truncated preview of particle content
|
// preview of particle content: preserve structure, trim long string fields
|
||||||
let jsonPreview = '';
|
let jsonPreview = '';
|
||||||
try {
|
try {
|
||||||
const content = particle.content;
|
jsonPreview = JSON.stringify(objectDeepCloneWithStringLimit(particle.content, 'aix-debugger-particle', 64));
|
||||||
jsonPreview = JSON.stringify(content).substring(0, 1024);
|
|
||||||
if (jsonPreview.length >= 1024) jsonPreview += '...';
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
jsonPreview = 'Error parsing content';
|
jsonPreview = 'Error parsing content';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user