初始化仓库及v1.0.0提交

This commit is contained in:
2026-05-05 03:21:58 +08:00
commit 813bb02672
67 changed files with 5263 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
<?php
namespace App\Services;
use App\Services\Providers\OpenAIProvider;
use App\Services\Providers\ClaudeProvider;
use App\Services\Providers\NewAPIProvider;
class AIService
{
public static function streamChat(string $providerName, string $model, array $messages, array $options, callable $onChunk): void
{
$provider = self::getProvider($providerName);
$provider::stream($model, $messages, $options, $onChunk);
}
public static function getProvider(string $name): string
{
return match ($name) {
'openai' => OpenAIProvider::class,
'claude' => ClaudeProvider::class,
'newapi' => NewAPIProvider::class,
default => throw new \RuntimeException('不支持的供应商: ' . $name)
};
}
}