albocode / ccatphp-sdk Goto Github PK
View Code? Open in Web Editor NEWPHP Library client to help cheshire cat communication in your project
PHP Library client to help cheshire cat communication in your project
FEATURE: Add delete history conversation method (per user) with http endpoint /memory/conversation_history/
I have noticed that the notification handler function for streaming messages not receive first tokens but start from second or third, so the message chain is incomplete (i stream the message via api to another apllication).
The message received in response to $cCatClient->sendMessage othwerwise contains all tokens.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.