To add a download button for a GitHub folder, which allows easy downloading of a specific folder, you can follow these steps
< Feedback on GitHub Folder Downloader
<?php require 'vendor/autoload.php';
use GuzzleHttp\Client; use Dotenv\Dotenv;
$dotenv = Dotenv::createImmutable(DIR); $dotenv->load();
$apiKey = $_ENV['API_KEY'] ?? null;
if (!$apiKey) { echo "Error: Missing API_KEY in .env\n"; exit(1); }
function createChatSession($externalUserId, $apiKey) { $client = new Client(); $url = 'https://api.on-demand.io/chat/v1/sessions'; $headers = [ 'apikey' => $apiKey, 'Content-Type' => 'application/json' ]; $body = [ 'agentIds' => [], 'externalUserId' => $externalUserId ];
try { $response = $client->post($url, [ 'headers' => $headers, 'json' => $body ]); $data = json_decode($response->getBody(), true); return $data['data']['id'] ?? null; } catch (Exception $e) { $message = $e->getMessage(); echo "Session creation failed: $message\n"; throw new Exception("Failed to create session: $message"); }
}
function submitQuery($sessionId, $query, $apiKey) { $client = new Client(); $url = "https://api.on-demand.io/chat/v1/sessions/{$sessionId}/query"; $headers = [ 'apikey' => $apiKey, 'Content-Type' => 'application/json' ]; $body = [ 'endpointId' => 'predefined-openai-gpt4o', 'query' => $query, 'agentIds' => 'agent-1712327325
Sign in to post a reply.
<?php require 'vendor/autoload.php';
use GuzzleHttp\Client; use Dotenv\Dotenv;
$dotenv = Dotenv::createImmutable(DIR); $dotenv->load();
$apiKey = $_ENV['API_KEY'] ?? null;
if (!$apiKey) { echo "Error: Missing API_KEY in .env\n"; exit(1); }
function createChatSession($externalUserId, $apiKey) { $client = new Client(); $url = 'https://api.on-demand.io/chat/v1/sessions'; $headers = [ 'apikey' => $apiKey, 'Content-Type' => 'application/json' ]; $body = [ 'agentIds' => [], 'externalUserId' => $externalUserId ];
}
function submitQuery($sessionId, $query, $apiKey) { $client = new Client(); $url = "https://api.on-demand.io/chat/v1/sessions/{$sessionId}/query"; $headers = [ 'apikey' => $apiKey, 'Content-Type' => 'application/json' ]; $body = [ 'endpointId' => 'predefined-openai-gpt4o', 'query' => $query, 'agentIds' => 'agent-1712327325