add_action('rest_api_init', function () { register_rest_route('foundry/v1', '/chat', array( 'methods' => 'POST', 'callback' => 'foundry_chat_handler', 'permission_callback' => '__return_true' )); }); function foundry_chat_handler($request) { $input = $request->get_json_params(); $userMessage = $input['message']; $tenantId = 'ae715931-12a2-4d6b-bd98-d3f6e11b1659'; $clientId = 'b2ebafc4-596b-4cdd-bfc2-89bbaf233090'; $clientSecret = '~vD8Q~LZiMUfac2GYcZshtpASkoWSZlEusHo8ddF'; // トークン取得 $token_url = "https://login.microsoftonline.com/$tenantId/oauth2/v2.0/token"; $token_response = wp_remote_post($token_url, array( 'body' => array( 'client_id' => $clientId, 'client_secret' => $clientSecret, 'scope' => 'https://cognitiveservices.azure.com/.default', 'grant_type' => 'client_credentials' ) )); $token_body = json_decode(wp_remote_retrieve_body($token_response), true); $access_token = $token_body['access_token']; // Foundry API 呼び出し $endpoint = 'https://sasal-foundry.services.ai.azure.com/api/projects/proj-default/applications/chatbot/protocols/openai/responses?api-version=2025-11-15-preview'; $body = array( "messages" => array( array( "role" => "user", "content" => $userMessage ) ) ); $response = wp_remote_post($endpoint, array( 'headers' => array( 'Authorization' => 'Bearer ' . $access_token, 'Content-Type' => 'application/json' ), 'body' => json_encode($body) )); return json_decode(wp_remote_retrieve_body($response), true); } Page not found – SASAL, INC
SASAL, INC

404

Sorry but the page you are looking for does not exist, have been removed, name changed or is temporarity unavailable.