adityadees/laravel-google-bard

用于 Google Bard 人工智能聊天机器人的 Laravel 包

v1.1.1 2023-06-11 14:06 UTC

This package is auto-updated.

Last update: 2024-09-11 20:43:22 UTC


README

用于 Google Bard 人工智能聊天机器人的 Laravel 包

安装

  • composer require adityadees/laravel-google-bard
  • php artisan vendor:publish --tag=laravel-bard
  • 新文件 laravel-bard.php 将在 config 文件夹下创建
  • bard_token 中填写您的令牌

Bard 令牌

访问 https://bard.google.com/,进入开发者工具或按 F12,应用 → Cookies → 复制 __Secure-1PSID 令牌的值。

image

运行

$bard = (new LaravelBard())->get_answer('type_your_text_here');

# to get the reply just access this array
$bard["content"];

# you can access others array like this
$bard["conversation_id"];
$bard["response_id"];
$bard["factualityQueries"];
$bard["textQuery"];
$bard["choices"];

示例

$bard = (new LaravelBard())->get_answer('hello whats your name');
dd($bard["content"]);
image

欢迎帮助改进此包

注意:该包包含来自仓库 https://github.com/dsdanielpark/Bard-API 的资源