定制 shcherbanich/symfony-console-gpt 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

shcherbanich/symfony-console-gpt

最新稳定版本:v0.1.0

Composer 安装命令:

composer require shcherbanich/symfony-console-gpt

包简介

Use console application through regular chat with ConsoleGpt!

README 文档

README

This library allows seamless integration of a GPT-based chat interface with symfony/console, enabling users to execute one command or a sequence of commands and manipulate them interactively via chat.

Have you dreamed of speaking the same language with your application? 😀

Try chatting with the demo app

$ OPENAI_API_KEY='<your API key>' php demo/demo.php chat

Features

  • Run Console Commands: Execute a single Symfony console command or a sequence of commands through an interactive chat.
  • Processing the result: Dynamically change and modify the return result of console commands. If you want to display it in the form of a table, please do so. Translating into any language is not a problem.
  • Easy to use: Integrate ConsoleGpt into your existing Symfony console application and start talking to it today!

Installation

  1. Add the library to your project via Composer:

    composer require shcherbanich/symfony-console-gpt
  2. Ensure your project uses Symfony Console (symfony/console).

  3. Add the Chat command to your Symfony console application.

  4. Set the environment variable OPENAI_API_KEY.

Usage

Basic Setup

The library provides a ready-to-use command: ConsoleGpt\Command\ChatCommand. You can use it in your project in two ways:

  1. Add the Command to Your Application
    Include the ChatCommand in your console application:

    use ConsoleGpt\Command\ChatCommand;
    use Symfony\Component\Console\Application;
    
    $application = new Application();
    $application->add(new ChatCommand());
    $application->run();
  2. Inherit from the Chat Application

    namespace MyApp\Console;
    
    use ConsoleGpt\Application as ChatApplication;
    
    final class SomeApp extends ChatApplication
    {
        // Add custom behavior here
    }

In this case, the command will be available in your application.

Running the Chat Command

Run the chat command in your console:

$ OPENAI_API_KEY='<your API key>' php console chat

and enjoy the magic :)

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-01-06