pushpak1300/ai-chat 问题修复 & 功能扩展

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

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

pushpak1300/ai-chat

Composer 安装命令:

composer create-project pushpak1300/ai-chat

包简介

A modern AI chat starter kit built with Laravel, featuring real-time streaming responses using Prism, Inertia.js, Vue.js, and TailwindCSS.

README 文档

README

prism

AI Chat - Laravel Starter Kit

A modern AI chat starter kit built with Laravel, featuring real-time streaming responses using Prism, Inertia.js, Vue.js, and TailwindCSS.

Introduction

Prism Chat provides a solid foundation for building AI-powered chat applications with Laravel. It leverages Laravel's powerful ecosystem combined with the Prism PHP SDK to deliver real-time streaming responses, creating a dynamic and engaging user experience.

Features

  • Real-time AI Responses: Stream AI responses as they're generated
  • Reasoning Support: Built-in support for AI models with reasoning capabilities
  • Multiple AI Providers: Support for OpenAI, Anthropic, Google Gemini, Ollama, Groq, Mistral, DeepSeek, xAI, and VoyageAI
  • Authentication System: Built-in user authentication and management
  • Appearance Settings: Light/dark mode support with system preference detection
  • Custom Theming: Shadcn integration allows easy theme customization via CSS variables
  • Chat Sharing: Share conversations with other users

Tech Stack

  • Backend: Laravel 12.x, Prism PHP SDK
  • Frontend: Vue.js 3, Inertia.js 2.x
  • Styling: TailwindCSS 4.x, Shadcn components
  • Database: SQLite (configurable to MySQL/PostgreSQL)
  • Authentication: Laravel Sanctum
  • Real-time: Server-Sent Events (SSE)

Prerequisites

  • PHP 8.3+ with extensions:
    • curl, dom, fileinfo, filter, hash, mbstring, openssl, pcre, pdo, session, tokenizer, xml
  • Composer 2.x
  • Node.js 18+ and npm/bun
  • SQLite (or MySQL/PostgreSQL if preferred)

Installation

Installation can be done using the Laravel installer:

laravel new --using=pushpak1300/ai-chat my-ai-chat
cd my-ai-chat

Or using Composer:

composer create-project pushpak1300/ai-chat my-ai-chat
cd my-ai-chat

After installation:

# Install frontend dependencies
npm install

# Generate application key (if not done automatically)
php artisan key:generate

# Create database file (for SQLite)
touch database/database.sqlite

# Run migrations
php artisan migrate

# Start the development server
composer run dev

The composer run dev command runs multiple processes concurrently. If you encounter issues, run them separately.

Configuration

Environment Setup

Copy the example environment file and configure your settings:

cp .env.example .env

Theme Customization

The application uses Shadcn components with TailwindCSS for styling. To customize the theme:

  1. Visit tweakcn.com to generate custom CSS variables
  2. Update the CSS variables in resources/css/app.css
  3. The changes will automatically apply to all Shadcn components

AI Provider Configuration

Note: You don't need to configure all providers. The application will work with any combination of the providers you set up.

Configuring AI Models

AI models are defined in the app/Enums/ModelName.php file. This enum defines which models are available in your application and their metadata.

Understanding the ModelName Enum

The ModelName enum serves as the central configuration point for all AI models in your application. Here's how it works:

<?php

namespace App\Enums;

use Prism\Prism\Enums\Provider;

enum ModelName: string
{
    // OpenAI Models
    case GPT_4O = 'gpt-4o';
    case GPT_4O_MINI = 'gpt-4o-mini';
    case O1_MINI = 'o1-mini';
    case O1_PREVIEW = 'o1-preview';

    // Anthropic Models
    case CLAUDE_3_5_SONNET = 'claude-3-5-sonnet-20241022';
    case CLAUDE_3_5_HAIKU = 'claude-3-5-haiku-20241022';
    case CLAUDE_3_OPUS = 'claude-3-opus-20240229';

    // Google Gemini Models
    case GEMINI_1_5_PRO = 'gemini-1.5-pro';
    case GEMINI_1_5_FLASH = 'gemini-1.5-flash';

    // Add more models as needed...
}

Adding New Models

To add support for new AI models, follow these steps:

  1. Add the Model Case: Add a new case to the enum with the exact model identifier used by the provider:
case NEW_MODEL = 'provider-model-name';
  1. Implement Required Methods: Each model must implement several methods:
public function getName(): string
{
    return match ($this) {
        self::NEW_MODEL => 'Human-Readable Name',
        // ... other cases
    };
}

public function getDescription(): string
{
    return match ($this) {
        self::NEW_MODEL => 'Brief description of model capabilities',
        // ... other cases
    };
}

public function getProvider(): Provider
{
    return match ($this) {
        self::NEW_MODEL => Provider::YourProvider,
        // ... other cases
    };
}

Deployment

Easy Deployment Options

For hassle-free deployment, consider these Laravel-optimized hosting platforms:

Laravel Cloud

Deploy directly with Laravel Cloud for seamless integration.

Sevalla

Sevalla.com offers Laravel-focused hosting with a free trial.

Roadmap

We're continuously working to enhance the AI Chat experience. Here's what's coming:

  • Multimodal Support: Image, audio, and video processing capabilities
  • Tool Call Support: Function calling and tool integration for enhanced AI interactions
  • Image Generation: Built-in support for AI image generation models
  • Resumable Streams: Ability to pause and resume streaming conversations

Security

Reporting Security Issues

If you discover security vulnerabilities, please email pushpak1300@gmail.com instead of using the issue tracker.

Troubleshooting

Common Issues

"Provider not configured" errors:

  • Ensure the required API key is set in your .env file
  • Verify the API key is valid and has sufficient credits/quota
  • Check that the provider service is operational

Streaming not working:

  • Verify your server supports Server-Sent Events (SSE)
  • Check firewall settings for long-running connections
  • Ensure proper CORS configuration for cross-origin requests

Model not appearing in UI:

  • Confirm the model is added to ModelName enum
  • Verify the provider is properly configured
  • Check browser console for JavaScript errors

Getting Help

Contributing

Contributions are welcome!

Development Setup

# Clone the repository
git clone https://github.com/pushpak1300/ai-chat.git
cd ai-chat

# Install dependencies
composer install
npm install

# Set up environment
cp .env.example .env
php artisan key:generate

# Run development server
composer dev

License

This project is open-sourced software licensed under the MIT license.

Built with ❤️ using Laravel, Prism, and Inertia.js

pushpak1300/ai-chat 适用场景与选型建议

pushpak1300/ai-chat 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 392 次下载、GitHub Stars 达 375, 最近一次更新时间为 2025 年 06 月 09 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 pushpak1300/ai-chat 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 392
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 375
  • 点击次数: 24
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 375
  • Watchers: 10
  • Forks: 52
  • 开发语言: PHP

其他信息

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