Skip to content

Commit e21c264

Browse files
committed
Fixes to sidebar so that it all fits
1 parent b1e6225 commit e21c264

File tree

3 files changed

+29
-10
lines changed

3 files changed

+29
-10
lines changed

app/frontend/src/components/AnalysisPanel/AnalysisPanel.module.css

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,22 @@
5555
max-height: 18.75em;
5656
}
5757

58+
.tPropRow {
59+
flex-wrap: wrap;
60+
gap: 5px;
61+
max-width: 100%;
62+
margin-bottom: 0.5em;
63+
}
64+
5865
.tProp {
66+
display: inline-block;
5967
background-color: #d7d7d7;
60-
color: #333232;
61-
font-size: 0.75em;
68+
font-size: 0.95em;
6269
padding: 0.1875em 0.625em;
6370
border-radius: 0.625em;
64-
margin-bottom: 0.5em;
71+
margin-bottom: 0.3em;
72+
word-break: break-word;
73+
white-space: normal;
6574
}
6675

6776
.citationImg {

app/frontend/src/components/AnalysisPanel/ThoughtProcess.tsx

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,38 @@ interface Props {
1515
thoughts: Thoughts[];
1616
}
1717

18+
// Helper to truncate URLs
19+
function truncateImageUrl(val: string) {
20+
if (typeof val === "string" && val.startsWith("data:image/")) {
21+
// Show only the first 30 chars and add ellipsis
22+
return val.slice(0, 30) + "...";
23+
} else if (typeof val === "string" && val.startsWith("http")) {
24+
const blobIndex = val.indexOf(".blob.core.windows.net/");
25+
return blobIndex !== -1 ? val.slice(blobIndex + ".blob.core.windows.net/".length) : val;
26+
}
27+
return val;
28+
}
29+
1830
export const ThoughtProcess = ({ thoughts }: Props) => {
1931
return (
2032
<ul className={styles.tList}>
2133
{thoughts.map((t, ind) => {
2234
return (
2335
<li className={styles.tListItem} key={ind}>
2436
<div className={styles.tStep}>{t.title}</div>
25-
<Stack horizontal tokens={{ childrenGap: 5 }}>
37+
<Stack horizontal tokens={{ childrenGap: 5 }} className={styles.tPropRow}>
2638
{t.props &&
2739
(Object.keys(t.props).filter(k => k !== "token_usage" && k !== "query_plan") || []).map((k: any) => (
2840
<span className={styles.tProp} key={k}>
29-
{k}: {JSON.stringify(t.props?.[k])}
41+
{k}: {truncateImageUrl(JSON.stringify(t.props?.[k]))}
3042
</span>
3143
))}
3244
</Stack>
3345
{t.props?.token_usage && <TokenUsageGraph tokenUsage={t.props.token_usage} reasoningEffort={t.props.reasoning_effort} />}
3446
{t.props?.query_plan && <AgentPlan query_plan={t.props.query_plan} description={t.description} />}
3547
{Array.isArray(t.description) ? (
36-
<SyntaxHighlighter language="json" wrapLongLines className={styles.tCodeBlock} style={a11yLight}>
37-
{JSON.stringify(t.description, null, 2)}
48+
<SyntaxHighlighter language="json" wrapLines wrapLongLines className={styles.tCodeBlock} style={a11yLight}>
49+
{JSON.stringify(t.description, (key, value) => truncateImageUrl(value), 2)}
3850
</SyntaxHighlighter>
3951
) : (
4052
<div>{t.description}</div>

todo.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
TODO:
22

3-
* Fix/add unit tests - check coverage
4-
* mypy
53
* Test with integrated vectorization
64
* Test with user upload feature
75
* Update all TODOs in the code/docs
8-
* shall i truncate the image_urls to ".data:image/png;base64,asdsa...." for the JSON display
6+
* Fix/add unit tests - check coverage
97

108
Decide:
119
* In conftest, should I make a new env for vision? Currently I mashed it into the existing env, but it might be cleaner to have a separate one, as now I have to pass llm_inputs explicitly in the tests to turn off image responses.

0 commit comments

Comments
 (0)