-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Cheshire cat 1.4 introduce sessions for users, also when a file is sent to rabbithole, to enable this on your code simply edit the CCatClient.php file on line 93 in this way:
public function rabbitHole(string $filePath, ?string $fileName, ?int $chunkSize, ?int $chunkOverlap, string $user_id = 'user'): PromiseInterface
{
$promise = $this->httpClient->getHttpClient()->postAsync('rabbithole/', [
'multipart' => [
[
'name' => 'file',
'contents' => Utils::tryFopen($filePath, 'r'),
'filename' => $fileName ?? null
],
'headers' => ['user_id' => $user_id]
]
]);
return $promise;
}
/**
* @param string $webUrl
* @param int|null $chunkSize
* @param int|null $chunkOverlap
* @return PromiseInterface
*/
public function rabbitHoleWeb(string $webUrl, ?int $chunkSize, ?int $chunkOverlap, string $user_id = 'user'): PromiseInterface
{
$promise = $this->httpClient->getHttpClient()->postAsync('rabbithole/web/', [
'json' => [
'url' => $webUrl
],
'headers' => ['user_id' => $user_id]
]);
return $promise;
}
I suggest also to set the rabbithole/web enpoint with abbithole/web/ because if the cat is behind a nginx https reverse proxy there is a 301 response code if non end slash is present
Metadata
Metadata
Assignees
Labels
No labels