AiCommandService.php 1.2 KB
<?php
/**
 * @remark :
 * @name   :AiCommandService.php
 * @author :lyh
 * @method :post
 * @time   :2025/5/26 17:01
 */

namespace App\Services;

/**
 * @remark :AI指令返回数据
 * @name   :AiCommandService
 * @author :lyh
 * @method :post
 * @time   :2025/5/26 17:01
 */
class AiCommandService
{
    public $url = 'https://api.cmer.com/v2/chat';

    public $api_key = 'nnLsyr3IhPNsJt5OvTtD9SVCLEixMntg';

    public $model = 'gemini-2.0-flash-lite';

    public $supplier = 'google';

    /**
     * @remark :Ai一键排版
     * @name   :ai_click_layout
     * @author :lyh
     * @method :post
     * @time   :2025/5/26 17:03
     */
    public function send_layout_design($content){
        $param = [
            'messages'=>[
                ['content'=>$content, 'role'=>'user'],
            ],
            'model'=> $this->model,
            'supplier'=> $this->supplier,
            'security_check'=> false
        ];
        $header = array(
            "Accept: application/json",
            "X-CmerApi-Host: llm-chat.p.cmer.com",
            "apikey: $this->api_key",
            "Content-Type:application/json;charset=utf-8",
        );
        $result = http_post($this->url,json_encode($param,true),$header);
        return $result;
    }

}