1
This commit is contained in:
@@ -259,23 +259,18 @@ function search_array_val($arr, $val)
|
||||
}
|
||||
}
|
||||
|
||||
function GptChar($message,$ckey,$mid="")
|
||||
function GptChar($message,$ckey)
|
||||
{
|
||||
$url = 'https://api.openai.com/v1/chat/completions';
|
||||
|
||||
// OpenAI API key
|
||||
$api_key = Env::get("gpt.api_key");
|
||||
|
||||
$mes['role'] = "user";
|
||||
$mes['content'] = $message;
|
||||
if($mid!=""){
|
||||
$mes['name'] = $mid;
|
||||
}
|
||||
|
||||
// Request data
|
||||
$data = array(
|
||||
'model' => 'gpt-3.5-turbo',
|
||||
'messages' => [$mes],
|
||||
'messages' => $message,
|
||||
'temperature' => 0.2,
|
||||
'max_tokens' => 2048,
|
||||
'n' => 1,
|
||||
@@ -323,7 +318,7 @@ function GptChar($message,$ckey,$mid="")
|
||||
if($cache_id!=''){
|
||||
Cache::set($ckey."_id",$cache_id);
|
||||
}
|
||||
Cache::set($ckey,$cc."[{enddata}]",3600);
|
||||
Cache::set($ckey,(Cache::get($ckey)?Cache::get($ckey):'')."[{enddata}]",3600);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user