mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
feat: Add directory tree tab to session files
This commit is contained in:
@@ -2,6 +2,7 @@ import type {
|
||||
AttachmentMetadata,
|
||||
AuthResponse,
|
||||
DeleteUploadResponse,
|
||||
ListDirectoryResponse,
|
||||
FileReadResponse,
|
||||
FileSearchResponse,
|
||||
GitCommandResponse,
|
||||
@@ -239,6 +240,18 @@ export class ApiClient {
|
||||
return await this.request<FileReadResponse>(`/api/sessions/${encodeURIComponent(sessionId)}/file?${params.toString()}`)
|
||||
}
|
||||
|
||||
async listSessionDirectory(sessionId: string, path?: string): Promise<ListDirectoryResponse> {
|
||||
const params = new URLSearchParams()
|
||||
if (path) {
|
||||
params.set('path', path)
|
||||
}
|
||||
|
||||
const qs = params.toString()
|
||||
return await this.request<ListDirectoryResponse>(
|
||||
`/api/sessions/${encodeURIComponent(sessionId)}/directory${qs ? `?${qs}` : ''}`
|
||||
)
|
||||
}
|
||||
|
||||
async uploadFile(sessionId: string, filename: string, content: string, mimeType: string): Promise<UploadFileResponse> {
|
||||
return await this.request<UploadFileResponse>(`/api/sessions/${encodeURIComponent(sessionId)}/upload`, {
|
||||
method: 'POST',
|
||||
|
||||
Reference in New Issue
Block a user