Skip to content

Commit 81ebd3c

Browse files
authored
make infra research threads open by default in progress view (#3047)
1 parent e96d4e8 commit 81ebd3c

12 files changed

Lines changed: 37 additions & 45 deletions

File tree

assets/design-system/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@
7878
"react-stately": "3.42.0",
7979
"react-use-measure": "2.1.1",
8080
"rehype-raw": "7.0.0",
81-
"remark-gfm": "4.0.0",
8281
"resize-observer-polyfill": "1.5.1",
8382
"type-fest": "4.8.3",
8483
"use-immer": "0.9.0",

assets/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
"react-virtualized-auto-sizer": "1.0.26",
103103
"react-window": "1.8.11",
104104
"react-window-reversed": "1.4.1",
105+
"remark-gfm": "4.0.0",
105106
"semver": "7.5.4",
106107
"streamsaver": "2.0.6",
107108
"styled-components": "6.1.15",

assets/src/components/ai/chatbot/ChatMessage.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ export function PrLinkoutCard({ url, title }: { url: string; title: string }) {
245245
window.open(url, '_blank')
246246
}}
247247
css={{
248-
padding: `${theme.spacing.small}px ${theme.spacing.large}px`,
248+
padding: `${theme.spacing.xsmall}px ${theme.spacing.small}px`,
249249
width: '100%',
250250
}}
251251
>
@@ -258,8 +258,8 @@ export function PrLinkoutCard({ url, title }: { url: string; title: string }) {
258258
align="center"
259259
>
260260
<AppIcon
261-
icon={<GitHubLogoIcon size={32} />}
262-
size="xsmall"
261+
icon={<GitHubLogoIcon size={24} />}
262+
size="xxsmall"
263263
/>
264264
<Body2BoldP $color="text-light">{title}</Body2BoldP>
265265
</Flex>

assets/src/components/ai/chatbot/multithread/ChatbotMultiThreadViewer.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const DOT_GAP = 16
1414
const STEPPER_LEFT_OFFSET = 16
1515
const THREAD_GAP: SemanticSpacingKey = 'small'
1616
// trigger height with compact padding (padding + content + padding)
17-
const TRIGGER_HEIGHT = 36
17+
const TRIGGER_HEIGHT = 46
1818

1919
export function ChatbotMultiThreadViewer({
2020
threads,
@@ -24,9 +24,13 @@ export function ChatbotMultiThreadViewer({
2424
isExpectingStream?: boolean
2525
}) {
2626
const { borders, borderRadiuses } = useTheme()
27-
27+
const threadIdList = threads.map((thread) => thread.id)
2828
return (
29-
<WrapperAccordionSC type="multiple">
29+
<WrapperAccordionSC
30+
type="multiple"
31+
key={threadIdList.join('-')} // force re-render when threads change
32+
defaultValue={threadIdList}
33+
>
3034
{threads.map((thread) => (
3135
<StepperAccordionItemSC
3236
key={thread.id}

assets/src/components/ai/chatbot/multithread/MultiThreadViewerMessage.tsx

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,17 @@
1+
import { Code, getLastStringChild, Modal } from '@pluralsh/design-system'
2+
import { CaptionP } from 'components/utils/typography/Text'
3+
import { ChatFragment, ChatType } from 'generated/graphql'
14
import { ReactElement, ReactNode, useState } from 'react'
25
import ReactMarkdown from 'react-markdown'
36
import remarkGfm from 'remark-gfm'
47
import styled from 'styled-components'
5-
import { Code, getLastStringChild, Modal } from '@pluralsh/design-system'
6-
import { ChatFragment, ChatType } from 'generated/graphql'
7-
import { CaptionP } from 'components/utils/typography/Text'
88
import { ToolCallContent } from '../ToolCallContent'
99

1010
export function MultiThreadViewerMessage({
1111
message,
1212
}: {
1313
message: ChatFragment
1414
}) {
15-
return (
16-
<WrapperSC>
17-
<MessageContent message={message} />
18-
</WrapperSC>
19-
)
20-
}
21-
22-
function MessageContent({
23-
message,
24-
}: {
25-
message: ChatFragment
26-
}): ReactElement | null {
2715
switch (message.type) {
2816
case ChatType.Tool:
2917
return <ToolCallLabel message={message} />
@@ -143,10 +131,6 @@ function SimplifiedMarkdown({ text }: { text: string }) {
143131
)
144132
}
145133

146-
const WrapperSC = styled.div(({ theme }) => ({
147-
padding: `${theme.spacing.xxsmall}px 0`,
148-
}))
149-
150134
const ClickableLabelSC = styled.button(({ theme }) => ({
151135
background: 'none',
152136
border: 'none',

assets/src/components/ai/chatbot/multithread/MultiThreadViewerThreadMessages.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ const WrapperSC = styled.div(({ theme }) => ({
7777
display: 'flex',
7878
flexDirection: 'column',
7979
gap: theme.spacing.small,
80+
padding: theme.spacing.small,
81+
wordBreak: 'break-word',
82+
textWrap: 'pretty',
8083
color: theme.colors['text-long-form'],
8184
maxHeight: 320,
8285
overflow: 'auto',

assets/src/components/ai/infra-research/details/InfraResearch.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import {
2929
useFixResearchDiagramMutation,
3030
useInfraResearchQuery,
3131
} from 'generated/graphql'
32-
import { capitalize, isEmpty, truncate } from 'lodash'
32+
import { capitalize, truncate } from 'lodash'
3333
import { ReactNode, useMemo, useState } from 'react'
3434
import { useMatch, useNavigate } from 'react-router-dom'
3535
import {
@@ -112,7 +112,7 @@ export function InfraResearch() {
112112
if (!(infraResearch || loading))
113113
return <EmptyState message="Infra research not found." />
114114

115-
const { status, analysis, diagram } = infraResearch ?? {}
115+
const { status, analysis, diagram, threads } = infraResearch ?? {}
116116
const isRunning = status === InfraResearchStatus.Running
117117

118118
const headerButtons =
@@ -169,8 +169,10 @@ export function InfraResearch() {
169169
{status && (
170170
<InfraResearchStatusChip
171171
status={status}
172-
clickable={!isEmpty(infraResearch?.threads)}
173-
onClick={() => goToInfraResearch(id)}
172+
{...((isRunning || (threads?.length ?? 0) > 1) && {
173+
clickable: true,
174+
onClick: () => goToInfraResearch(id),
175+
})}
174176
/>
175177
)}
176178
{!isChatbotOpen && headerButtons}

assets/src/components/ai/insights/InsightDisplay.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export function InsightDisplay({
7474
<ContentHeaderSC css={{ paddingRight: 0 }}>
7575
<Flex gap="small">
7676
<SearchIcon />
77-
<span>{"insight's evidence"}</span>
77+
<span>evidence</span>
7878
</Flex>
7979
<IconFrame
8080
clickable

assets/src/components/ai/insights/LogsEvidencePanel.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export function BasicEvidenceLine({
9393
<IconFrame
9494
icon={icon}
9595
css={{ flexShrink: 0 }}
96-
type="floating"
96+
type="secondary"
9797
/>
9898
<span css={{ ...TRUNCATE, flex: 1 }}>{content}</span>
9999
<IconFrame
@@ -123,7 +123,7 @@ const EvidenceLineSC = styled.div<{ $table: boolean }>(({ theme, $table }) => ({
123123
alignItems: 'center',
124124
gap: theme.spacing.small,
125125
cursor: 'pointer',
126-
padding: `${theme.spacing.small}px ${theme.spacing.medium}px`,
126+
padding: `${theme.spacing.xsmall}px ${theme.spacing.small}px`,
127127
borderBottom: $table ? theme.borders.input : 'none',
128128
'&:hover': {
129129
backgroundColor: $table ? theme.colors['fill-one-hover'] : 'transparent',

assets/src/components/utils/tableFetchHelpers.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export function useFetchSlice<
8181
const [endCursors, setEndCursors] = useState<
8282
{ index: number; cursor: string }[]
8383
>([])
84-
const endCursor = queryResult?.data?.[queryKey]?.pageInfo.endCursor
84+
const endCursor = queryResult?.data?.[queryKey]?.pageInfo?.endCursor
8585
const endCursorIndex = (queryResult?.data?.[queryKey]?.edges?.length ?? 0) - 1
8686
const prevEndCursor = usePrevious(endCursor)
8787

0 commit comments

Comments
 (0)