Skip to content

Commit 05c3bb9

Browse files
committed
docs(Search): improve tools display and rules
1 parent ff67fa3 commit 05c3bb9

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

docs/app/components/search/SearchChat.vue

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ function upperName(name: string) {
7070
return splitByCase(name).map(p => upperFirst(p)).join('')
7171
}
7272
73-
function getToolMessage(state: UIToolInvocation<any>['state'], toolName: string, input: any) {
73+
type State = UIToolInvocation<any>['state']
74+
75+
function getToolMessage(state: State, toolName: string, input: any) {
7476
const searchVerb = state === 'output-available' ? 'Searched' : 'Searching'
7577
const readVerb = state === 'output-available' ? 'Read' : 'Reading'
7678
@@ -84,18 +86,21 @@ function getToolMessage(state: UIToolInvocation<any>['state'], toolName: string,
8486
get_documentation_page: `${readVerb} ${input.path || ''} page`,
8587
list_documentation_pages: `${searchVerb} documentation pages`,
8688
list_getting_started_guides: `${searchVerb} documentation guides`,
87-
get_migration_guide: `${readVerb} ${input.version} migration guide`,
89+
get_migration_guide: `${readVerb} migration guide${input.version ? ` for ${input.version}` : ''}`,
8890
list_examples: `${searchVerb} examples`,
8991
get_example: `${readVerb} ${upperName(input.exampleName)} example`,
9092
search_components_by_category: `${searchVerb} components${input.category ? ` in ${input.category} category` : ''}${input.search ? ` for "${input.search}"` : ''}`
9193
}[toolName] || `${searchVerb} ${toolName}`
9294
}
95+
96+
const getCachedToolMessage = useMemoize((state: State, toolName: string, input: string) =>
97+
getToolMessage(state, toolName, JSON.parse(input))
98+
)
9399
</script>
94100

95101
<template>
96102
<UChatPalette>
97103
<UChatMessages
98-
should-auto-scroll
99104
:messages="chat.messages"
100105
:status="chat.status"
101106
:user="{ side: 'left', variant: 'naked', icon: 'i-lucide-user' }"
@@ -115,7 +120,7 @@ function getToolMessage(state: UIToolInvocation<any>['state'], toolName: string,
115120
/>
116121

117122
<p v-if="part.type === 'dynamic-tool'" class="text-muted text-sm leading-6 my-1.5">
118-
{{ getToolMessage(part.state, part.toolName, part.input || {}) }}
123+
{{ getCachedToolMessage(part.state, part.toolName, JSON.stringify(part.input || {})) }}
119124
</p>
120125
</template>
121126
</div>

docs/server/api/search.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,16 @@ Guidelines:
2222
- ALWAYS use tools to search for information. Never rely on pre-trained knowledge.
2323
- If no relevant information is found after searching, respond with "Sorry, I couldn't find information about that in the documentation."
2424
- Be concise and direct in your responses.
25-
- When providing code examples, always use the \`vue\` language identifier for syntax highlighting.
26-
- NEVER use markdown headings (no #, ##, ###, ####, etc.) in your responses. Use **bold text** for emphasis instead.
25+
26+
**FORMATTING RULES (CRITICAL):**
27+
- ABSOLUTELY NO MARKDOWN HEADINGS: Never use #, ##, ###, ####, #####, or ######
28+
- NO underline-style headings with === or ---
29+
- Use **bold text** for emphasis and section labels instead
30+
- Examples:
31+
* Instead of "## Usage", write "**Usage:**" or just "Here's how to use it:"
32+
* Instead of "# Complete Guide", write "**Complete Guide**" or start directly with content
33+
- Start all responses with content, never with a heading
34+
2735
- Reference specific component names, props, or APIs when applicable.
2836
- If a question is ambiguous, ask for clarification rather than guessing.
2937
- When multiple relevant items are found, list them clearly using bullet points.

0 commit comments

Comments
 (0)