AiCommandService.php
1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?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';
/**
* @remark :Ai一键排版
* @name :ai_click_layout
* @author :lyh
* @method :post
* @time :2025/5/26 17:03
*/
public function ai_click_layout(){
$param = [
'messages'=>[
'content'=>'',
'role'=>'user',
],
'model'=> 'gemini-2.0-flash-lite',
'supplier'=> 'google',
'security_check'=> false
];
$header = [
'accept'=>'application/json',
'X-CmerApi-Host'=>'llm-chat.p.cmer.com',
'apikey'=>$this->api_key,
'Content-Type'=>'application/json'
];
$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,$param,$header);
return $result;
}
}