feat(post): 新增手机图片排版与AI智能排版功能

- 新增手机图片排版功能,支持小红书/抖音尺寸输出
- 新增AI智能排版顾问,支持内容分析与优化推荐
- 新增AI供应商管理,支持多渠道配置与同步
- 新增文章输出管理页面,支持图片预览与批量下载
- 新增字体文件与排版样式配置
This commit is contained in:
augushong
2026-05-01 12:23:17 +08:00
parent b4558b55fb
commit 83a2bd48a2
25 changed files with 4440 additions and 0 deletions

View File

@@ -96,4 +96,91 @@ class System extends Common
return $this->success('清楚成功');
}
/**
* AI 设置页面.
*/
public function ai()
{
return View::fetch();
}
/**
* 同步 models.dev 数据.
*/
public function syncModelsDev()
{
$sync = new \app\common\tools\ai\ModelsDevSync();
try {
$result = $sync->syncProviders();
$count = count($result['providers'] ?? []);
return json(['code' => 0, 'msg' => "同步成功, 共{$count}个供应商", 'data' => $result]);
} catch (\Exception $e) {
return json(['code' => 500, 'msg' => '同步失败: ' . $e->getMessage()]);
}
}
/**
* 测试AI渠道连接.
*/
public function testAiChannel()
{
$providerId = $this->request->param('provider_id', '');
if (empty($providerId)) {
return json(['code' => 500, 'msg' => '缺少供应商ID']);
}
$manager = new \app\common\tools\ai\AiChannelManager();
$provider = $manager->getProvider($providerId);
if (!$provider) {
return json(['code' => 500, 'msg' => '供应商未配置或缺少API Key']);
}
$ok = $provider->testConnection();
return json(['code' => $ok ? 0 : 500, 'msg' => $ok ? '连接成功' : '连接失败,请检查配置']);
}
/**
* 获取指定供应商的模型列表.
*/
public function getModelsByProvider()
{
$providerId = $this->request->param('provider_id', '');
$sync = new \app\common\tools\ai\ModelsDevSync();
$models = $sync->getModelsByProvider($providerId);
return json(['code' => 0, 'data' => $models]);
}
/**
* 获取 models.dev 缓存状态.
*/
public function getAiCacheStatus()
{
$sync = new \app\common\tools\ai\ModelsDevSync();
$status = $sync->getCacheStatus();
return json(['code' => 0, 'data' => $status]);
}
/**
* 保存AI渠道配置.
*/
public function saveAiChannel()
{
$data = $this->request->post();
$manager = new \app\common\tools\ai\AiChannelManager();
$ok = $manager->saveChannelConfig($data);
return json(['code' => $ok ? 0 : 500, 'msg' => $ok ? '保存成功' : '保存失败']);
}
/**
* 删除AI渠道配置.
*/
public function deleteAiChannel()
{
$providerId = $this->request->param('provider_id', '');
if (empty($providerId)) {
return json(['code' => 500, 'msg' => '缺少供应商ID']);
}
$manager = new \app\common\tools\ai\AiChannelManager();
$ok = $manager->deleteChannelConfig($providerId);
return json(['code' => $ok ? 0 : 500, 'msg' => $ok ? '删除成功' : '删除失败']);
}
}