Skip to content

Commit 4805cf3

Browse files
committed
improvement(copilot): preserve docs path casing in read labels
1 parent be702bc commit 4805cf3

2 files changed

Lines changed: 9 additions & 13 deletions

File tree

apps/sim/lib/copilot/tools/client/store-utils.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,24 +49,24 @@ describe('resolveToolDisplay', () => {
4949
).toBe('Read RET XYZ')
5050
})
5151

52-
it('formats docs corpus reads as Section/page', () => {
52+
it('formats docs corpus reads as section/page', () => {
5353
expect(
5454
resolveToolDisplay(ReadTool.id, ClientToolCallState.success, {
5555
path: 'docs/workflows/blocks/agent.mdx',
5656
})?.text
57-
).toBe('Read Workflows/agent')
57+
).toBe('Read workflows/agent')
5858

5959
expect(
6060
resolveToolDisplay(ReadTool.id, ClientToolCallState.executing, {
6161
path: 'docs/integrations/gmail.mdx',
6262
})?.text
63-
).toBe('Reading Integrations/gmail')
63+
).toBe('Reading integrations/gmail')
6464

6565
expect(
6666
resolveToolDisplay(ReadTool.id, ClientToolCallState.error, {
6767
path: 'docs/getting-started.mdx',
6868
})?.text
69-
).toBe('Attempted to read Getting-started')
69+
).toBe('Attempted to read getting-started')
7070
})
7171

7272
it('decodes percent-encoded VFS path segments for display', () => {

apps/sim/lib/copilot/tools/client/store-utils.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -145,20 +145,16 @@ function describeFileReadTarget(segments: string[]): string {
145145
}
146146

147147
/**
148-
* Labels a docs/ corpus read as `<Section>/<page>` (e.g. `Workflows/agent` for
149-
* docs/workflows/blocks/agent.mdx). Top-level pages show just their capitalized
150-
* name (e.g. `Getting-started` for docs/getting-started.mdx).
148+
* Labels a docs/ corpus read as `<section>/<page>` (e.g. `workflows/agent` for
149+
* docs/workflows/blocks/agent.mdx). Top-level pages show just their name (e.g.
150+
* `getting-started` for docs/getting-started.mdx).
151151
*/
152152
function describeDocsReadTarget(segments: string[]): string {
153153
const rest = segments.slice(1)
154154
if (rest.length === 0) return 'docs'
155155
const leaf = stripExtension(rest[rest.length - 1])
156-
if (rest.length === 1) return capitalizeFirst(leaf)
157-
return `${capitalizeFirst(rest[0])}/${leaf}`
158-
}
159-
160-
function capitalizeFirst(value: string): string {
161-
return value.charAt(0).toUpperCase() + value.slice(1)
156+
if (rest.length === 1) return leaf
157+
return `${rest[0]}/${leaf}`
162158
}
163159

164160
function getLeafResourceSegment(segments: string[]): string {

0 commit comments

Comments
 (0)