Spaces:
Runtime error
Runtime error
File size: 777 Bytes
c7052c4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | import { DeleteFileResponse, ErrorResponse } from '../types';
import { CohereErrorResponse } from './types';
import { CohereErrorResponseTransform } from './utils';
export const CohereDeleteFileResponseTransform: (
response: Response | CohereErrorResponse,
responseStatus: number,
_responseHeaders: Record<string, string>,
_strictOpenAiCompliance: boolean,
gatewayRequestUrl: string,
) => DeleteFileResponse | ErrorResponse = (
response,
responseStatus,
_responseHeaders,
_strictOpenAiCompliance,
gatewayRequestUrl,
) => {
if (responseStatus !== 200 && 'message' in response) {
return CohereErrorResponseTransform(response);
}
const id = gatewayRequestUrl.split('/').pop() || '';
return {
object: 'file',
deleted: true,
id,
};
};
|