临时保存
This commit is contained in:
@@ -286,6 +286,208 @@ class Config extends BaseModel
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取支持的AI平台类型
|
||||
* @return array
|
||||
*/
|
||||
public function getSupportAIPlatformTypes()
|
||||
{
|
||||
return [
|
||||
['value' => 'dify', 'label' => 'Dify'],
|
||||
['value' => 'ragflow', 'label' => 'Ragflow'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置AI第三平台提供的配置信息
|
||||
* @$data
|
||||
* @param int $site_id
|
||||
* @param string $app_module
|
||||
* @return array
|
||||
*/
|
||||
public function setAIPlatformConfig($data, $site_id = 1, $app_module = 'shop')
|
||||
{
|
||||
$config = new ConfigModel();
|
||||
$res = $config->setConfig($data, 'AI第三平台提供的配置信息', 1, [ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'AI_PLATFORM_CONFIG' ] ]);
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取AI第三平台提供的配置信息
|
||||
* @param int $site_id
|
||||
* @param string $app_module
|
||||
* @return array
|
||||
*/
|
||||
public function getAIPlatformConfig($site_id = 1, $app_module = 'shop')
|
||||
{
|
||||
$config = new ConfigModel();
|
||||
$res = $config->getConfig([ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'AI_PLATFORM_CONFIG' ] ]);
|
||||
if (empty($res[ 'data' ][ 'value' ])) {
|
||||
$id = time();
|
||||
$res[ 'data' ][ 'value' ] = [
|
||||
'default' => [ 'id' => $id, 'name'=> 'dify-demo' ],
|
||||
'list' => [
|
||||
// Dify Demo 版本,
|
||||
['id' => $id, 'name' => 'dify-demo', 'type' => 'dify', 'type_label' => 'Dify', 'desc' => 'Dify Demo 版本', 'enable' => 1, 'api_url' => 'https://api.dify.cn', 'api_key' => '', 'create_time' => time()],
|
||||
]
|
||||
];
|
||||
return $res;
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置AI智能客服配置信息
|
||||
* @param $data 配置信息
|
||||
* @param int $site_id
|
||||
* @param string $app_module
|
||||
* @return array
|
||||
*/
|
||||
public function setAIAgentServicesConfig($data, $site_id = 1, $app_module = 'shop')
|
||||
{
|
||||
$config = new ConfigModel();
|
||||
$res = $config->setConfig($data, 'AI配置信息', 1, [ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'AI_AGENT_SERVICES_CONFIG' ] ]);
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得AI智能客服配置信息
|
||||
* @param int $site_id
|
||||
* @param string $app_module
|
||||
* @return array
|
||||
*/
|
||||
public function getAIAgentServicesConfig($site_id = 1, $app_module = 'shop')
|
||||
{
|
||||
$config = new ConfigModel();
|
||||
$res = $config->getConfig([ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'AI_AGENT_SERVICES_CONFIG' ] ]);
|
||||
if (empty($res[ 'data' ][ 'value' ])) {
|
||||
$res[ 'data' ][ 'value' ] = [
|
||||
// 是否开启AI功能
|
||||
'enable' => false,
|
||||
// 用户头像url
|
||||
'user_avatar' => [
|
||||
'en'=> '',
|
||||
'zh_CN' => '',
|
||||
],
|
||||
// AI客服头像url
|
||||
'ai_avatar' => [
|
||||
'en'=> '',
|
||||
'zh_CN' => '',
|
||||
],
|
||||
// AI客服姓名
|
||||
'ai_name' => [
|
||||
'en'=> '',
|
||||
'zh_CN' => '',
|
||||
],
|
||||
// 欢迎语, 也称为开场白,初始化消息
|
||||
'welcome_messages' => [
|
||||
'en'=> [],
|
||||
'zh_CN' => [],
|
||||
],
|
||||
// 是否显示加载更多按钮
|
||||
'show_load_more_button' => true,
|
||||
// 最大消息数量
|
||||
'max_messages' => 100,
|
||||
// 是否启用流式响应
|
||||
'stream_mode' => true,
|
||||
// 流式响应的超时时间,单位:秒
|
||||
'stream_timeout' => 30,
|
||||
// 流式响应速度(字符/秒)
|
||||
'stream_speed' => 20,
|
||||
// 是否开启支持语音输入
|
||||
'support_voice_input' => false,
|
||||
// 语音输入的提示信息
|
||||
'voice_input_prompt' => [
|
||||
'en' => 'Please click the microphone icon to start recording',
|
||||
'zh_CN' => '请点击麦克风图标开始录音',
|
||||
],
|
||||
// 是否开启语音输入提示
|
||||
'support_voice_input_prompt' => false,
|
||||
// 输入文本内容提示
|
||||
'text_input_prompt' => [
|
||||
'en' => 'Please enter your problem',
|
||||
'zh_CN' => '请输入您的问题',
|
||||
],
|
||||
// 输入的问题描述的字符长度限制
|
||||
'max_char_length_for_problem' => 500,
|
||||
// 是否支持显示更多工具面板
|
||||
'tool_panel_config' =>[
|
||||
'enable' => false,
|
||||
'title' => [
|
||||
'en' => 'More Tools',
|
||||
'zh_CN' => '更多功能',
|
||||
],
|
||||
'icon' => 'icon-more',
|
||||
// 工具面板中的工具项
|
||||
'tools' => [
|
||||
'image' => [
|
||||
'enable' => false,
|
||||
'name' => [
|
||||
'en' => 'Image',
|
||||
'zh_CN' => '图片',
|
||||
],
|
||||
'description' =>[
|
||||
'en'=> 'Upload image',
|
||||
'zh_CN' => '上传图片',
|
||||
],
|
||||
'icon' => 'icon-image',
|
||||
],
|
||||
'video' =>[
|
||||
'enable' => false,
|
||||
'name' => [
|
||||
'en' => 'Video',
|
||||
'zh_CN' => '视频',
|
||||
],
|
||||
'description' => [
|
||||
'en'=> 'Upload video',
|
||||
'zh_CN' => '上传视频',
|
||||
],
|
||||
'icon' => 'icon-video',
|
||||
],
|
||||
'file' => [
|
||||
'enable' => false,
|
||||
'name' => [
|
||||
'en' => 'File',
|
||||
'zh_CN' => '文件',
|
||||
],
|
||||
'description' => [
|
||||
'en'=> 'Upload file',
|
||||
'zh_CN' => '上传文件',
|
||||
],
|
||||
'icon' => 'icon-file',
|
||||
],
|
||||
'voice' =>[
|
||||
'enable' => false,
|
||||
'name'=> [
|
||||
'en' => 'Voice',
|
||||
'zh_CN' => '语音',
|
||||
],
|
||||
'description' =>[
|
||||
'en'=> 'Voice input',
|
||||
'zh_CN' => '语音输入',
|
||||
],
|
||||
'icon'=> 'icon-voice',
|
||||
],
|
||||
'location' => [
|
||||
'enable' => false,
|
||||
'name' => [
|
||||
'en' => 'Location',
|
||||
'zh_CN' => '位置',
|
||||
],
|
||||
'description' => [
|
||||
'en'=> 'Location input',
|
||||
'zh_CN' => '位置输入',
|
||||
],
|
||||
'icon'=> 'icon-location',
|
||||
],
|
||||
],
|
||||
]
|
||||
];
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置获取H5域名配置
|
||||
* @param $data
|
||||
|
||||
Reference in New Issue
Block a user