Download desktop/src/api/search.ts from chenbhao/codev: direct link, hf CLI and curl.
- Browser
- Download file 691 Bytes
-
https://huggingface.co/chenbhao/codev/resolve/e40073cc959cd4729bf4009662bca374c5c4e266/desktop/src/api/search.ts
- Command line
-
hf download hf://chenbhao/codev@e40073cc959cd4729bf4009662bca374c5c4e266/desktop/src/api/search.ts
-
curl -L -o search.ts https://huggingface.co/chenbhao/codev/resolve/e40073cc959cd4729bf4009662bca374c5c4e266/desktop/src/api/search.ts
691 Bytes
| import { api } from './client' | |
| type SearchResult = { | |
| file: string | |
| line: number | |
| text: string | |
| context?: string[] | |
| } | |
| type SearchResponse = { results: SearchResult[]; total: number } | |
| type SessionSearchResult = { | |
| sessionId: string | |
| title: string | |
| matchCount: number | |
| matches: Array<{ line: number; text: string }> | |
| } | |
| type SessionSearchResponse = { results: SessionSearchResult[] } | |
| export const searchApi = { | |
| search(params: { query: string; cwd?: string; maxResults?: number; glob?: string }) { | |
| return api.post<SearchResponse>('/api/search', params) | |
| }, | |
| searchSessions(query: string) { | |
| return api.post<SessionSearchResponse>('/api/search/sessions', { query }) | |
| }, | |
| } | |