mirror of
https://github.com/simstudioai/sim.git
synced 2026-02-06 12:45:07 -05:00
* feat(claude): added rules * fix(copilot): chat loading; refactor(copilot): components, utils, hooks * fix(copilot): options selection strikethrough * fix(copilot): options render inside thinking * fix(copilot): checkpoints, user-input; improvement(code): colors * fix(copilot): scrolling, tool-call truncation, thinking ui * fix(copilot): tool call spacing and shimmer/actions on previous messages * improvement(copilot): queue * addressed comments
53 lines
2.0 KiB
TypeScript
53 lines
2.0 KiB
TypeScript
import { Loader2, MinusCircle, Search, XCircle } from 'lucide-react'
|
|
import {
|
|
BaseClientTool,
|
|
type BaseClientToolMetadata,
|
|
ClientToolCallState,
|
|
} from '@/lib/copilot/tools/client/base-tool'
|
|
|
|
export class GetExamplesRagClientTool extends BaseClientTool {
|
|
static readonly id = 'get_examples_rag'
|
|
|
|
constructor(toolCallId: string) {
|
|
super(toolCallId, GetExamplesRagClientTool.id, GetExamplesRagClientTool.metadata)
|
|
}
|
|
|
|
static readonly metadata: BaseClientToolMetadata = {
|
|
displayNames: {
|
|
[ClientToolCallState.generating]: { text: 'Fetching examples', icon: Loader2 },
|
|
[ClientToolCallState.pending]: { text: 'Fetching examples', icon: Loader2 },
|
|
[ClientToolCallState.executing]: { text: 'Fetching examples', icon: Loader2 },
|
|
[ClientToolCallState.success]: { text: 'Fetched examples', icon: Search },
|
|
[ClientToolCallState.error]: { text: 'Failed to fetch examples', icon: XCircle },
|
|
[ClientToolCallState.aborted]: { text: 'Aborted getting examples', icon: MinusCircle },
|
|
[ClientToolCallState.rejected]: { text: 'Skipped getting examples', icon: MinusCircle },
|
|
},
|
|
interrupt: undefined,
|
|
getDynamicText: (params, state) => {
|
|
if (params?.query && typeof params.query === 'string') {
|
|
const query = params.query
|
|
|
|
switch (state) {
|
|
case ClientToolCallState.success:
|
|
return `Found examples for ${query}`
|
|
case ClientToolCallState.executing:
|
|
case ClientToolCallState.generating:
|
|
case ClientToolCallState.pending:
|
|
return `Searching examples for ${query}`
|
|
case ClientToolCallState.error:
|
|
return `Failed to find examples for ${query}`
|
|
case ClientToolCallState.aborted:
|
|
return `Aborted searching examples for ${query}`
|
|
case ClientToolCallState.rejected:
|
|
return `Skipped searching examples for ${query}`
|
|
}
|
|
}
|
|
return undefined
|
|
},
|
|
}
|
|
|
|
async execute(): Promise<void> {
|
|
return
|
|
}
|
|
}
|