Skip to content

Commit

Permalink
add delete converation history by user
Browse files Browse the repository at this point in the history
  • Loading branch information
AlboCode committed Dec 18, 2023
1 parent 2c80d5d commit ca6cab9
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 34 deletions.
8 changes: 6 additions & 2 deletions src/CCatClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,13 @@ public function getMemoryRecall(string $text, ?int $k = null, ?string $user_id =
* @return ResponseInterface
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function deleteConversationHistory(): ResponseInterface
public function deleteConversationHistory(string $userId = "user"): ResponseInterface
{
return $this->httpClient->getHttpClient()->delete("/memory/conversation_history");
return $this->httpClient->getHttpClient()->delete("/memory/conversation_history", [
"headers" => [
"user_id" => $userId
]
]);
}
// Memory API --
// -- Settings API
Expand Down
65 changes: 33 additions & 32 deletions src/index.php
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
<?php

require dirname(__DIR__).'/vendor/autoload.php';

use Albocode\CcatphpSdk\CCatClient;
use Albocode\CcatphpSdk\Clients\HttpClient;
use Albocode\CcatphpSdk\Clients\WSClient;

$cCatClient = new CCatClient(new WSClient('cheshire_cat_core'), new HttpClient('cheshire_cat_core', null, 'meow'));

try {
// $response = $cCatClient->putPluginSettings("cat_advanced_tools", [
//
// "prompt_prefix" => "You are a supportive AI that help during hard time" ,
// "episodic_memory_k" => 3,
// "episodic_memory_threshold" => 0.7,
// "declarative_memory_k" => 3,
// "declarative_memory_threshold" => 0.7,
// "procedural_memory_k" => 3,
// "procedural_memory_threshold" => 0.7,
// "user_name" => "Human",
// "language" => "English"
//
// ]);
$response = $cCatClient->deleteConversationHistory();
echo "<pre>";
var_dump($response);
echo "</pre>";

} catch (Exception $exception) {
var_dump($exception->getMessage());
}
//$response = $cCatClient->sendMessage(new \Albocode\CcatphpSdk\Model\Message("Ciao come stai?"), fn($message) => var_dump($message));
//
//require dirname(__DIR__).'/vendor/autoload.php';
//
//use Albocode\CcatphpSdk\CCatClient;
//use Albocode\CcatphpSdk\Clients\HttpClient;
//use Albocode\CcatphpSdk\Clients\WSClient;
//
//$cCatClient = new CCatClient(new WSClient('cheshire_cat_core'), new HttpClient('cheshire_cat_core', null, 'meow'));
//
//try {
// // $response = $cCatClient->putPluginSettings("cat_advanced_tools", [
// //
// // "prompt_prefix" => "You are a supportive AI that help during hard time" ,
// // "episodic_memory_k" => 3,
// // "episodic_memory_threshold" => 0.7,
// // "declarative_memory_k" => 3,
// // "declarative_memory_threshold" => 0.7,
// // "procedural_memory_k" => 3,
// // "procedural_memory_threshold" => 0.7,
// // "user_name" => "Human",
// // "language" => "English"
// //
// // ]);
// // $response = $cCatClient->deleteConversationHistory();
// echo "<pre>";
// // var_dump($response);
// echo "</pre>";
//
//} catch (Exception $exception) {
// var_dump($exception->getMessage());
//}
////$response = $cCatClient->sendMessage(new \Albocode\CcatphpSdk\Model\Message("Ciao come stai?", "test"), fn($message) => var_dump($message));
////var_dump($response);

0 comments on commit ca6cab9

Please sign in to comment.