|
@@ -22,6 +22,10 @@ class AiCommandService |
|
@@ -22,6 +22,10 @@ class AiCommandService |
|
22
|
|
22
|
|
|
23
|
public $api_key = 'nnLsyr3IhPNsJt5OvTtD9SVCLEixMntg';
|
23
|
public $api_key = 'nnLsyr3IhPNsJt5OvTtD9SVCLEixMntg';
|
|
24
|
|
24
|
|
|
|
|
25
|
+ public $model = 'gemini-2.0-flash-lite';
|
|
|
|
26
|
+
|
|
|
|
27
|
+ public $supplier = 'google';
|
|
|
|
28
|
+
|
|
25
|
/**
|
29
|
/**
|
|
26
|
* @remark :Ai一键排版
|
30
|
* @remark :Ai一键排版
|
|
27
|
* @name :ai_click_layout
|
31
|
* @name :ai_click_layout
|
|
@@ -29,29 +33,23 @@ class AiCommandService |
|
@@ -29,29 +33,23 @@ class AiCommandService |
|
29
|
* @method :post
|
33
|
* @method :post
|
|
30
|
* @time :2025/5/26 17:03
|
34
|
* @time :2025/5/26 17:03
|
|
31
|
*/
|
35
|
*/
|
|
32
|
- public function ai_click_layout(){
|
36
|
+ public function send_layout_design($content){
|
|
33
|
$param = [
|
37
|
$param = [
|
|
34
|
'messages'=>[
|
38
|
'messages'=>[
|
|
35
|
- 'content'=>'',
|
39
|
+ 'content'=>$content,
|
|
36
|
'role'=>'user',
|
40
|
'role'=>'user',
|
|
37
|
],
|
41
|
],
|
|
38
|
- 'model'=> 'gemini-2.0-flash-lite',
|
|
|
|
39
|
- 'supplier'=> 'google',
|
42
|
+ 'model'=> $this->model,
|
|
|
|
43
|
+ 'supplier'=> $this->supplier,
|
|
40
|
'security_check'=> false
|
44
|
'security_check'=> false
|
|
41
|
];
|
45
|
];
|
|
42
|
- $header = [
|
|
|
|
43
|
- 'accept'=>'application/json',
|
|
|
|
44
|
- 'X-CmerApi-Host'=>'llm-chat.p.cmer.com',
|
|
|
|
45
|
- 'apikey'=>$this->api_key,
|
|
|
|
46
|
- 'Content-Type'=>'application/json'
|
|
|
|
47
|
- ];
|
|
|
|
48
|
$header = array(
|
46
|
$header = array(
|
|
49
|
"Accept: application/json",
|
47
|
"Accept: application/json",
|
|
50
|
"X-CmerApi-Host: llm-chat.p.cmer.com",
|
48
|
"X-CmerApi-Host: llm-chat.p.cmer.com",
|
|
51
|
"apikey: $this->api_key",
|
49
|
"apikey: $this->api_key",
|
|
52
|
"Content-Type:application/json;charset=utf-8",
|
50
|
"Content-Type:application/json;charset=utf-8",
|
|
53
|
);
|
51
|
);
|
|
54
|
- $result = http_post($this->url,$param,$header);
|
52
|
+ $result = http_post($this->url,json_encode($param,true),$header);
|
|
55
|
return $result;
|
53
|
return $result;
|
|
56
|
}
|
54
|
}
|
|
57
|
} |
55
|
} |