新增一個下載按鈕,允許輕鬆下載特定的 GitHub 資料夾。
< 腳本GitHub 資料夾下載器的回應
<?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
登入以回覆
土豆服务器,请按需使用
镜像地址随时可能被墙,建议加群获取最新地址
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址
<?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