sabir/chatgpt 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

sabir/chatgpt

Composer 安装命令:

composer require sabir/chatgpt

包简介

A Laravel package for interacting with ChatGPT APIs.

README 文档

README

To integrate the ChatGPT package with PHP and Laravel, please follow these steps:

Install the package: Install the package via Composer by running the following command in your project directory:

composer require sabir/chatgpt:dev-master Publish configuration file: Run the following command to publish the package's configuration file:

php artisan vendor:publish --tag=chatgpt-config --ansi --force This command will create a configuration file named chatgpt.php in your Laravel project's config directory.

Set API key and model: Open the .env file in your project's root folder and set the values for the following environment variables:

CHAT_API=YOUR_CHAT_API_KEY CHAT_MODEL=YOUR_CHAT_MODEL_ID Replace YOUR_CHAT_API_KEY with your OpenAI Chat API key and YOUR_CHAT_MODEL_ID with the model ID you want to use (e.g., "davinci", "curie", "babbage", or "ada").

Create an instance and call the chat method: In your Laravel code, you can now create an instance of the ChatGPT class and call the chat method to interact with the ChatGPT model. Here's an example:

use Sabir\ChatGPT\Facades\ChatGPT;

// ...

$s = new ChatGPT(); $response = $s->chat('hi, how are you?'); dd($response);

The chat method accepts three parameters:

message (required): The message or prompt to send to the ChatGPT model. type (optional): The API type to use for the chat. If left blank or set to "devinci", "curie", "babbage", or "ada", it will use the OpenAI models. You can extend this functionality to include other types if needed. options (optional): An array of additional options for the API request, such as temperature, max_tokens, top_p, etc. The chat method will return the response from the ChatGPT model.

Note: The provided code snippet is a simplified example. You may need to adjust it based on your project structure and requirements.

Ensure that you have properly configured the API key, model ID, and other settings according to your OpenAI account and desired behavior.

sabir/chatgpt 适用场景与选型建议

sabir/chatgpt 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 64 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 03 月 15 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「api」 「laravel」 「chatbot」 「GPT-3」 「gpt3」 「ChatGpt」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 sabir/chatgpt 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 sabir/chatgpt 我们能提供哪些服务?
定制开发 / 二次开发

基于 sabir/chatgpt 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 64
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 14
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-03-15