Skip to content

Commit

Permalink
remove SRO from some FileManager functions
Browse files Browse the repository at this point in the history
  • Loading branch information
DellaBitta committed Jul 17, 2024
1 parent 20b16fb commit c4c8426
Showing 1 changed file with 2 additions and 21 deletions.
23 changes: 2 additions & 21 deletions packages/main/src/server/file-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,16 @@ export class GoogleAIFileManager {

/**
* Upload a file.
*
* Any fields set in the optional {@link SingleRequestOptions} parameter will take
* precedence over the {@link RequestOptions} values provided at the time of the
* {@link GoogleAIFileManager} initialization.
*/
async uploadFile(
filePath: string,
fileMetadata: FileMetadata,
requestOptions: SingleRequestOptions = {},
): Promise<UploadFileResponse> {
const file = readFileSync(filePath);
const filesRequestOptions: SingleRequestOptions = {
...this._requestOptions,
...requestOptions,
};

const url = new FilesRequestUrl(
RpcTask.UPLOAD,
this.apiKey,
filesRequestOptions,
this._requestOptions,
);

const uploadHeaders = getHeaders(url);
Expand Down Expand Up @@ -161,23 +151,14 @@ export class GoogleAIFileManager {

/**
* Delete file with given ID.
*
* Any fields set in the optional {@link SingleRequestOptions} parameter will take
* precedence over the {@link RequestOptions} values provided at the time of the
* {@link GoogleAIFileManager} initialization.
*/
async deleteFile(
fileId: string,
requestOptions: SingleRequestOptions = {},
): Promise<void> {
const filesRequestOptions: SingleRequestOptions = {
...this._requestOptions,
...requestOptions,
};
const url = new FilesRequestUrl(
RpcTask.DELETE,
this.apiKey,
filesRequestOptions,
this._requestOptions,
);
url.appendPath(parseFileId(fileId));
const uploadHeaders = getHeaders(url);
Expand Down

0 comments on commit c4c8426

Please sign in to comment.