mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-12 03:01:12 +00:00
perf: 优化AI设置
This commit is contained in:
parent
ccbd873204
commit
976b300277
@ -121,82 +121,82 @@ class Setting extends AbstractModel
|
|||||||
{
|
{
|
||||||
return match ($ai) {
|
return match ($ai) {
|
||||||
'openai' => [
|
'openai' => [
|
||||||
'gpt-4: GPT-4',
|
'gpt-4 | GPT-4',
|
||||||
'gpt-4-turbo: GPT-4 Turbo',
|
'gpt-4-turbo | GPT-4 Turbo',
|
||||||
'gpt-4o: GPT-4o',
|
'gpt-4o | GPT-4o',
|
||||||
'gpt-4o-mini: GPT-4o Mini',
|
'gpt-4o-mini | GPT-4o Mini',
|
||||||
'o1: GPT-o1',
|
'o1 | GPT-o1',
|
||||||
'o1-mini: GPT-o1 Mini',
|
'o1-mini | GPT-o1 Mini',
|
||||||
'o3-mini: GPT-o3 Mini',
|
'o3-mini | GPT-o3 Mini',
|
||||||
'gpt-3.5-turbo: GPT-3.5 Turbo',
|
'gpt-3.5-turbo | GPT-3.5 Turbo',
|
||||||
'gpt-3.5-turbo-16k: GPT-3.5 Turbo 16K',
|
'gpt-3.5-turbo-16k | GPT-3.5 Turbo 16K',
|
||||||
'gpt-3.5-turbo-0125: GPT-3.5 Turbo 0125',
|
'gpt-3.5-turbo-0125 | GPT-3.5 Turbo 0125',
|
||||||
'gpt-3.5-turbo-1106: GPT-3.5 Turbo 1106'
|
'gpt-3.5-turbo-1106 | GPT-3.5 Turbo 1106'
|
||||||
],
|
],
|
||||||
'claude' => [
|
'claude' => [
|
||||||
'claude-3-5-sonnet-latest: Claude 3.5 Sonnet',
|
'claude-3-5-sonnet-latest | Claude 3.5 Sonnet',
|
||||||
'claude-3-5-sonnet-20241022: Claude 3.5 Sonnet 20241022',
|
'claude-3-5-sonnet-20241022 | Claude 3.5 Sonnet 20241022',
|
||||||
'claude-3-5-haiku-latest: Claude 3.5 Haiku',
|
'claude-3-5-haiku-latest | Claude 3.5 Haiku',
|
||||||
'claude-3-5-haiku-20241022: Claude 3.5 Haiku 20241022',
|
'claude-3-5-haiku-20241022 | Claude 3.5 Haiku 20241022',
|
||||||
'claude-3-opus-latest: Claude 3 Opus',
|
'claude-3-opus-latest | Claude 3 Opus',
|
||||||
'claude-3-opus-20240229: Claude 3 Opus 20240229',
|
'claude-3-opus-20240229 | Claude 3 Opus 20240229',
|
||||||
'claude-3-haiku-20240307: Claude 3 Haiku 20240307',
|
'claude-3-haiku-20240307 | Claude 3 Haiku 20240307',
|
||||||
'claude-2.1: Claude 2.1',
|
'claude-2.1 | Claude 2.1',
|
||||||
'claude-2.0: Claude 2.0'
|
'claude-2.0 | Claude 2.0'
|
||||||
],
|
],
|
||||||
'deepseek' => [
|
'deepseek' => [
|
||||||
'deepseek-chat: DeepSeek V3',
|
'deepseek-chat | DeepSeek V3',
|
||||||
'deepseek-reasoner: DeepSeek R1'
|
'deepseek-reasoner | DeepSeek R1'
|
||||||
],
|
],
|
||||||
'gemini' => [
|
'gemini' => [
|
||||||
'gemini-2.0-flash: Gemini 2.0 Flash',
|
'gemini-2.0-flash | Gemini 2.0 Flash',
|
||||||
'gemini-2.0-flash-lite-preview-02-05: Gemini 2.0 Flash-Lite Preview',
|
'gemini-2.0-flash-lite-preview-02-05 | Gemini 2.0 Flash-Lite Preview',
|
||||||
'gemini-1.5-flash: Gemini 1.5 Flash',
|
'gemini-1.5-flash | Gemini 1.5 Flash',
|
||||||
'gemini-1.5-flash-8b: Gemini 1.5 Flash 8B',
|
'gemini-1.5-flash-8b | Gemini 1.5 Flash 8B',
|
||||||
'gemini-1.5-pro: Gemini 1.5 Pro',
|
'gemini-1.5-pro | Gemini 1.5 Pro',
|
||||||
'gemini-1.0-pro: Gemini 1.0 Pro'
|
'gemini-1.0-pro | Gemini 1.0 Pro'
|
||||||
],
|
],
|
||||||
'grok' => [
|
'grok' => [
|
||||||
'grok-2-vision-1212: Grok 2 Vision 1212',
|
'grok-2-vision-1212 | Grok 2 Vision 1212',
|
||||||
'grok-2-vision: Grok 2 Vision',
|
'grok-2-vision | Grok 2 Vision',
|
||||||
'grok-2-vision-latest: Grok 2 Vision Latest',
|
'grok-2-vision-latest | Grok 2 Vision Latest',
|
||||||
'grok-2-1212: Grok 2 1212',
|
'grok-2-1212 | Grok 2 1212',
|
||||||
'grok-2: Grok 2',
|
'grok-2 | Grok 2',
|
||||||
'grok-2-latest: Grok 2 Latest',
|
'grok-2-latest | Grok 2 Latest',
|
||||||
'grok-vision-beta: Grok Vision Beta',
|
'grok-vision-beta | Grok Vision Beta',
|
||||||
'grok-beta: Grok Beta',
|
'grok-beta | Grok Beta',
|
||||||
],
|
],
|
||||||
'zhipu' => [
|
'zhipu' => [
|
||||||
'glm-4: GLM-4',
|
'glm-4 | GLM-4',
|
||||||
'glm-4-plus: GLM-4 Plus',
|
'glm-4-plus | GLM-4 Plus',
|
||||||
'glm-4-air: GLM-4 Air',
|
'glm-4-air | GLM-4 Air',
|
||||||
'glm-4-airx: GLM-4 AirX',
|
'glm-4-airx | GLM-4 AirX',
|
||||||
'glm-4-long: GLM-4 Long',
|
'glm-4-long | GLM-4 Long',
|
||||||
'glm-4-flash: GLM-4 Flash',
|
'glm-4-flash | GLM-4 Flash',
|
||||||
'glm-4v: GLM-4V',
|
'glm-4v | GLM-4V',
|
||||||
'glm-4v-plus: GLM-4V Plus',
|
'glm-4v-plus | GLM-4V Plus',
|
||||||
'glm-3-turbo: GLM-3 Turbo'
|
'glm-3-turbo | GLM-3 Turbo'
|
||||||
],
|
],
|
||||||
'qianwen' => [
|
'qianwen' => [
|
||||||
'qwen-max: QWEN Max',
|
'qwen-max | QWEN Max',
|
||||||
'qwen-max-latest: QWEN Max Latest',
|
'qwen-max-latest | QWEN Max Latest',
|
||||||
'qwen-turbo: QWEN Turbo',
|
'qwen-turbo | QWEN Turbo',
|
||||||
'qwen-turbo-latest: QWEN Turbo Latest',
|
'qwen-turbo-latest | QWEN Turbo Latest',
|
||||||
'qwen-plus: QWEN Plus',
|
'qwen-plus | QWEN Plus',
|
||||||
'qwen-plus-latest: QWEN Plus Latest',
|
'qwen-plus-latest | QWEN Plus Latest',
|
||||||
'qwen-long: QWEN Long'
|
'qwen-long | QWEN Long'
|
||||||
],
|
],
|
||||||
'wenxin' => [
|
'wenxin' => [
|
||||||
'ernie-4.0-8k: Ernie 4.0 8K',
|
'ernie-4.0-8k | Ernie 4.0 8K',
|
||||||
'ernie-4.0-8k-latest: Ernie 4.0 8K Latest',
|
'ernie-4.0-8k-latest | Ernie 4.0 8K Latest',
|
||||||
'ernie-4.0-turbo-128k: Ernie 4.0 Turbo 128K',
|
'ernie-4.0-turbo-128k | Ernie 4.0 Turbo 128K',
|
||||||
'ernie-4.0-turbo-8k: Ernie 4.0 Turbo 8K',
|
'ernie-4.0-turbo-8k | Ernie 4.0 Turbo 8K',
|
||||||
'ernie-3.5-128k: Ernie 3.5 128K',
|
'ernie-3.5-128k | Ernie 3.5 128K',
|
||||||
'ernie-3.5-8k: Ernie 3.5 8K',
|
'ernie-3.5-8k | Ernie 3.5 8K',
|
||||||
'ernie-speed-128k: Ernie Speed 128K',
|
'ernie-speed-128k | Ernie Speed 128K',
|
||||||
'ernie-speed-8k: Ernie Speed 8K',
|
'ernie-speed-8k | Ernie Speed 8K',
|
||||||
'ernie-lite-8k: Ernie Lite 8K',
|
'ernie-lite-8k | Ernie Lite 8K',
|
||||||
'ernie-tiny-8k: Ernie Tiny 8K'
|
'ernie-tiny-8k | Ernie Tiny 8K'
|
||||||
],
|
],
|
||||||
default => [],
|
default => [],
|
||||||
};
|
};
|
||||||
@ -213,11 +213,11 @@ class Setting extends AbstractModel
|
|||||||
$list = is_array($models) ? $models : explode("\n", $models);
|
$list = is_array($models) ? $models : explode("\n", $models);
|
||||||
$array = [];
|
$array = [];
|
||||||
foreach ($list as $item) {
|
foreach ($list as $item) {
|
||||||
list($value, $label) = explode(':', $item . ':');
|
$arr = Base::newTrim(explode('|', $item . '|'));
|
||||||
if ($value) {
|
if ($arr[0]) {
|
||||||
$array[] = [
|
$array[] = [
|
||||||
'value' => trim($value),
|
'value' => $arr[0],
|
||||||
'label' => trim($label ?: $value)
|
'label' => $arr[1] ?: $arr[0]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use App\Models\Setting;
|
||||||
|
use App\Module\Base;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class UpdateAiModelsTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$row = Setting::whereName('aibotSetting')->first();
|
||||||
|
if (empty($row)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$value = Base::json2array($row->getRawOriginal('setting'));
|
||||||
|
foreach ($value as $key => $item) {
|
||||||
|
if (str_ends_with($key, '_models')) {
|
||||||
|
$value[$key] = preg_replace('/\s*:\s*/', ' | ', $item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$row->setting = Base::array2json($value);
|
||||||
|
$row->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
$row = Setting::whereName('aibotSetting')->first();
|
||||||
|
if (empty($row)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$value = Base::json2array($row->getRawOriginal('setting'));
|
||||||
|
foreach ($value as $key => $item) {
|
||||||
|
if (str_ends_with($key, '_models')) {
|
||||||
|
$value[$key] = preg_replace('/\s*\|\s*/', ': ', $item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$row->setting = Base::array2json($value);
|
||||||
|
$row->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -49,7 +49,10 @@
|
|||||||
<!--AI 列表-->
|
<!--AI 列表-->
|
||||||
<DrawerOverlay v-model="aibotShow" placement="right" :size="720">
|
<DrawerOverlay v-model="aibotShow" placement="right" :size="720">
|
||||||
<div v-if="aibotShow" class="ivu-modal-wrap-apply">
|
<div v-if="aibotShow" class="ivu-modal-wrap-apply">
|
||||||
<div class="ivu-modal-wrap-apply-title">{{ $L('AI 列表') }}</div>
|
<div class="ivu-modal-wrap-apply-title">
|
||||||
|
{{ $L('AI 列表') }}
|
||||||
|
<p @click="applyClick({value: 'robot-setting'}, 'openai')" v-if="userIsAdmin">{{$L('机器人设置')}}</p>
|
||||||
|
</div>
|
||||||
<div class="ivu-modal-wrap-apply-body ai-body">
|
<div class="ivu-modal-wrap-apply-body ai-body">
|
||||||
<ul class="ai-list">
|
<ul class="ai-list">
|
||||||
<li v-for="(item, key) in aibotList" :key="key">
|
<li v-for="(item, key) in aibotList" :key="key">
|
||||||
@ -59,14 +62,12 @@
|
|||||||
<div class="ai-info">
|
<div class="ai-info">
|
||||||
<h4>{{ item.label }}</h4>
|
<h4>{{ item.label }}</h4>
|
||||||
<p class="ai-desc" @click="openDetail(item.desc)">{{ item.desc }}</p>
|
<p class="ai-desc" @click="openDetail(item.desc)">{{ item.desc }}</p>
|
||||||
<ul class="ai-modal">
|
<ul v-if="item.tags.length > 0" class="ai-modal">
|
||||||
<li>aa</li>
|
<li v-for="(tag, index) in item.tags" :key="index">{{ tag }}</li>
|
||||||
<li>22</li>
|
|
||||||
<li>cc</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
<div class="ai-btn">
|
<div class="ai-btn">
|
||||||
<Button icon="md-chatbubbles" :loading="aibotDialogSearchLoad == item.value" @click="onGoToChat(item.value)">{{ $L('开始聊天') }}</Button>
|
<Button icon="md-chatbubbles" :loading="aibotDialogSearchLoad == item.value" @click="onGoToChat(item.value)">{{ $L('开始聊天') }}</Button>
|
||||||
<Button icon="md-settings" @click="applyClick({value: 'robot-setting'}, item.value)">{{ $L('设置') }}</Button>
|
<Button v-if="userIsAdmin" icon="md-settings" @click="applyClick({value: 'robot-setting'}, item.value)">{{ $L('设置') }}</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
@ -78,7 +79,10 @@
|
|||||||
<!--AI 设置-->
|
<!--AI 设置-->
|
||||||
<DrawerOverlay v-model="aibotSettingShow" placement="right" :size="950">
|
<DrawerOverlay v-model="aibotSettingShow" placement="right" :size="950">
|
||||||
<div v-if="aibotSettingShow" class="ivu-modal-wrap-apply">
|
<div v-if="aibotSettingShow" class="ivu-modal-wrap-apply">
|
||||||
<div class="ivu-modal-wrap-apply-title">{{ $L('AI 设置') }}</div>
|
<div class="ivu-modal-wrap-apply-title">
|
||||||
|
{{ $L('AI 设置') }}
|
||||||
|
<p @click="aibotSettingShow=false">{{$L('返回')}}</p>
|
||||||
|
</div>
|
||||||
<div class="ivu-modal-wrap-apply-body">
|
<div class="ivu-modal-wrap-apply-body">
|
||||||
<Tabs v-model="aibotTabAction" :animated="false" class="ai-tabs">
|
<Tabs v-model="aibotTabAction" :animated="false" class="ai-tabs">
|
||||||
<TabPane label="ChatGPT" name="openai">
|
<TabPane label="ChatGPT" name="openai">
|
||||||
@ -255,6 +259,7 @@ import SystemThirdAccess from "./setting/components/SystemThirdAccess";
|
|||||||
import SystemEmailSetting from "./setting/components/SystemEmailSetting";
|
import SystemEmailSetting from "./setting/components/SystemEmailSetting";
|
||||||
import SystemAppPush from "./setting/components/SystemAppPush";
|
import SystemAppPush from "./setting/components/SystemAppPush";
|
||||||
import emitter from "../../store/events";
|
import emitter from "../../store/events";
|
||||||
|
import {AIBotList, AIModelNames} from "../../store/ai";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@ -277,62 +282,7 @@ export default {
|
|||||||
workReportShow: false,
|
workReportShow: false,
|
||||||
workReportTabs: "my",
|
workReportTabs: "my",
|
||||||
//
|
//
|
||||||
aibotList: [
|
aibotList: AIBotList,
|
||||||
{
|
|
||||||
value: "openai",
|
|
||||||
label: "ChatGPT",
|
|
||||||
src: $A.mainUrl('images/avatar/default_openai.png'),
|
|
||||||
desc: this.$L('我是一个人工智能助手,为用户提供问题解答和指导。我没有具体的身份,只是一个程序。您有什么问题可以问我哦?')
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "claude",
|
|
||||||
label: "Claude",
|
|
||||||
src: $A.mainUrl('images/avatar/default_claude.png'),
|
|
||||||
desc: this.$L('我是Claude,一个由Anthropic公司创造出来的AI助手机器人。我的工作是帮助人类,与人对话并给出解答。')
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "deepseek",
|
|
||||||
label: "DeepSeek",
|
|
||||||
src: $A.mainUrl('images/avatar/default_deepseek.png'),
|
|
||||||
desc: this.$L('DeepSeek大语言模型算法是北京深度求索人工智能基础技术研究有限公司推出的深度合成服务算法。')
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "gemini",
|
|
||||||
label: "Gemini",
|
|
||||||
src: $A.mainUrl('images/avatar/default_gemini.png'),
|
|
||||||
desc: `${this.$L('我是由Google开发的生成式人工智能聊天机器人。')}${this.$L('它基于同名的Gemini系列大型语言模型。')}${this.$L('是应对OpenAI公司开发的ChatGPT聊天机器人的崛起而开发的。')}`
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "grok",
|
|
||||||
label: "Grok",
|
|
||||||
src: $A.mainUrl('images/avatar/default_grok.png'),
|
|
||||||
desc: this.$L('Grok是由xAI开发的生成式人工智能聊天机器人,旨在通过实时回答用户问题来提供帮助。')
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "ollama",
|
|
||||||
label: "Ollama",
|
|
||||||
src: $A.mainUrl('images/avatar/default_ollama.png'),
|
|
||||||
desc: this.$L('Ollama 是一个轻量级、可扩展的框架,旨在让用户能够在本地机器上构建和运行大型语言模型。')
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "zhipu",
|
|
||||||
label: "Zhipu",
|
|
||||||
src: $A.mainUrl('images/avatar/default_zhipu.png'),
|
|
||||||
desc: `${this.$L('我是智谱清言,是智谱 AI 公司于2023训练的语言模型。')}${this.$L('我的任务是针对用户的问题和要求提供适当的答复和支持。')}`
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "qianwen",
|
|
||||||
label: "通义千问",
|
|
||||||
src: $A.mainUrl('avatar/%E9%80%9A%E4%B9%89%E5%8D%83%E9%97%AE.png'),
|
|
||||||
desc: this.$L('我是达摩院自主研发的超大规模语言模型,能够回答问题、创作文字,还能表达观点、撰写代码。')
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: "wenxin",
|
|
||||||
label: "文心一言",
|
|
||||||
src: $A.mainUrl('avatar/%E6%96%87%E5%BF%83.png'),
|
|
||||||
desc: this.$L('我是文心一言,英文名是ERNIE Bot。我能够与人对话互动,回答问题,协助创作,高效便捷地帮助人们获取信息、知识和灵感。')
|
|
||||||
},
|
|
||||||
],
|
|
||||||
aibotShow: false,
|
aibotShow: false,
|
||||||
aibotSettingShow: false,
|
aibotSettingShow: false,
|
||||||
aibotTabAction: "openai",
|
aibotTabAction: "openai",
|
||||||
@ -483,6 +433,7 @@ export default {
|
|||||||
this.workReportShow = true;
|
this.workReportShow = true;
|
||||||
break;
|
break;
|
||||||
case 'robot':
|
case 'robot':
|
||||||
|
this.getAITags();
|
||||||
this.aibotShow = true;
|
this.aibotShow = true;
|
||||||
break;
|
break;
|
||||||
case 'robot-setting':
|
case 'robot-setting':
|
||||||
@ -520,6 +471,24 @@ export default {
|
|||||||
}
|
}
|
||||||
this.$emit("on-click", item.value)
|
this.$emit("on-click", item.value)
|
||||||
},
|
},
|
||||||
|
// 获取AI标签
|
||||||
|
getAITags() {
|
||||||
|
this.$store.dispatch("call", {
|
||||||
|
url: 'system/setting/aibot',
|
||||||
|
}).then(({data}) => {
|
||||||
|
for (let key in data) {
|
||||||
|
const match = key.match(/^(.*?)_models$/);
|
||||||
|
if (match) {
|
||||||
|
const value = match[1];
|
||||||
|
this.aibotList.map(h => {
|
||||||
|
if (h.value == value) {
|
||||||
|
h.tags = AIModelNames(data[key]).map(item => item.label);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
// 开始聊天
|
// 开始聊天
|
||||||
onGoToChat(type) {
|
onGoToChat(type) {
|
||||||
let dialogId = 0;
|
let dialogId = 0;
|
||||||
|
|||||||
@ -57,6 +57,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {mapState} from "vuex";
|
import {mapState} from "vuex";
|
||||||
|
import {AIModelNames, AISystemConfig} from "../../../../store/ai";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "SystemAibot",
|
name: "SystemAibot",
|
||||||
@ -70,186 +71,7 @@ export default {
|
|||||||
loadIng: 0,
|
loadIng: 0,
|
||||||
formData: {},
|
formData: {},
|
||||||
ruleData: {},
|
ruleData: {},
|
||||||
aiConfig: {
|
aiConfig: AISystemConfig,
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
label: "API Key",
|
|
||||||
prop: "key",
|
|
||||||
type: "password"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "模型列表",
|
|
||||||
prop: "models",
|
|
||||||
type: "textarea",
|
|
||||||
placeholder: "一行一个模型名称",
|
|
||||||
functions: "使用默认模型列表"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "默认模型",
|
|
||||||
prop: "model",
|
|
||||||
type: "model",
|
|
||||||
placeholder: "请选择默认模型",
|
|
||||||
tip: "可选数据来自模型列表"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Base URL",
|
|
||||||
prop: "base_url",
|
|
||||||
placeholder: "Enter base URL...",
|
|
||||||
tip: "API请求的基础URL路径,如果没有请留空"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "使用代理",
|
|
||||||
prop: "agency",
|
|
||||||
placeholder: '支持 http 或 socks 代理',
|
|
||||||
tip: "例如:http://proxy.com 或 socks5://proxy.com"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Temperature",
|
|
||||||
prop: "temperature",
|
|
||||||
placeholder: "模型温度,低则保守,高则多样",
|
|
||||||
tip: "例如:0.7,范围:0-1,默认:0.7"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "默认提示词",
|
|
||||||
prop: "system",
|
|
||||||
type: "textarea",
|
|
||||||
placeholder: "请输入默认提示词",
|
|
||||||
tip: "例如:你是一个人开发的AI助手"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
aiList: {
|
|
||||||
openai: {
|
|
||||||
extraFields: [
|
|
||||||
{
|
|
||||||
prop: "key",
|
|
||||||
placeholder: "OpenAI API Key",
|
|
||||||
link: "https://platform.openai.com/account/api-keys"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: "models",
|
|
||||||
link: "https://platform.openai.com/docs/models",
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
claude: {
|
|
||||||
extraFields: [
|
|
||||||
{
|
|
||||||
prop: "key",
|
|
||||||
placeholder: "Claude API Key",
|
|
||||||
link: "https://docs.anthropic.com/en/api/getting-started"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: "models",
|
|
||||||
link: "https://docs.anthropic.com/en/docs/about-claude/models"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
deepseek: {
|
|
||||||
extraFields: [
|
|
||||||
{
|
|
||||||
prop: "key",
|
|
||||||
placeholder: "DeepSeek API Key",
|
|
||||||
link: "https://platform.deepseek.com/api_keys"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: "models",
|
|
||||||
link: "https://api-docs.deepseek.com/zh-cn/quick_start/pricing"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
gemini: {
|
|
||||||
extraFields: [
|
|
||||||
{
|
|
||||||
prop: "key",
|
|
||||||
placeholder: "Gemini API Key",
|
|
||||||
link: "https://makersuite.google.com/app/apikey"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: "models",
|
|
||||||
link: "https://ai.google.dev/models/gemini"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: "agency",
|
|
||||||
placeholder: "仅支持 http 代理",
|
|
||||||
tip: "例如:http://proxy.com"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
grok: {
|
|
||||||
extraFields: [
|
|
||||||
{
|
|
||||||
prop: "key",
|
|
||||||
placeholder: "Grok API Key",
|
|
||||||
link: "https://docs.x.ai/docs/tutorial"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: "models",
|
|
||||||
link: "https://docs.x.ai/docs/models"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
ollama: {
|
|
||||||
extraFields: [
|
|
||||||
{
|
|
||||||
prop: "key",
|
|
||||||
placeholder: "Ollama API Key",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: "models",
|
|
||||||
link: "https://ollama.com/models",
|
|
||||||
functions: null,
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
zhipu: {
|
|
||||||
extraFields: [
|
|
||||||
{
|
|
||||||
prop: "key",
|
|
||||||
placeholder: "Zhipu API Key",
|
|
||||||
link: "https://bigmodel.cn/usercenter/apikeys"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: "models",
|
|
||||||
link: "https://open.bigmodel.cn/dev/api"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
qianwen: {
|
|
||||||
extraFields: [
|
|
||||||
{
|
|
||||||
prop: "key",
|
|
||||||
placeholder: "Qianwen API Key",
|
|
||||||
link: "https://help.aliyun.com/zh/model-studio/developer-reference/get-api-key"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: "models",
|
|
||||||
link: "https://help.aliyun.com/zh/model-studio/getting-started/models"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
wenxin: {
|
|
||||||
extraFields: [
|
|
||||||
{
|
|
||||||
prop: "key",
|
|
||||||
placeholder: "Wenxin API Key",
|
|
||||||
link: "https://console.bce.baidu.com/qianfan/ais/console/applicationConsole/application/v1"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: "secret",
|
|
||||||
placeholder: "Wenxin Secret Key",
|
|
||||||
link: "https://console.bce.baidu.com/qianfan/ais/console/applicationConsole/application/v1",
|
|
||||||
type: "password",
|
|
||||||
label: "Secret Key",
|
|
||||||
after: "key"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: "models",
|
|
||||||
link: "https://cloud.baidu.com/doc/WENXINWORKSHOP/s/Blfmc9dlf"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@ -318,10 +140,7 @@ export default {
|
|||||||
modelOption(prop) {
|
modelOption(prop) {
|
||||||
const value = this.formData[prop + 's'];
|
const value = this.formData[prop + 's'];
|
||||||
if (value) {
|
if (value) {
|
||||||
return value.split('\n').map(item => {
|
return AIModelNames(value)
|
||||||
const [value, label] = `${item}:`.split(':');
|
|
||||||
return {value, label: label || value};
|
|
||||||
}, []).filter(item => item.value);
|
|
||||||
}
|
}
|
||||||
return []
|
return []
|
||||||
},
|
},
|
||||||
|
|||||||
262
resources/assets/js/store/ai.js
vendored
Normal file
262
resources/assets/js/store/ai.js
vendored
Normal file
@ -0,0 +1,262 @@
|
|||||||
|
const AIModelNames = (str) => {
|
||||||
|
const lines = str.split('\n').filter(line => line.trim());
|
||||||
|
|
||||||
|
return lines.map(line => {
|
||||||
|
const [value, label] = line.split('|').map(s => s.trim());
|
||||||
|
|
||||||
|
return {
|
||||||
|
value,
|
||||||
|
label: label || value
|
||||||
|
};
|
||||||
|
}, []).filter(item => item.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
const AIBotList = [
|
||||||
|
{
|
||||||
|
value: "openai",
|
||||||
|
label: "ChatGPT",
|
||||||
|
tags: [],
|
||||||
|
src: $A.mainUrl('images/avatar/default_openai.png'),
|
||||||
|
desc: $A.L('我是一个人工智能助手,为用户提供问题解答和指导。我没有具体的身份,只是一个程序。您有什么问题可以问我哦?')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "claude",
|
||||||
|
label: "Claude",
|
||||||
|
tags: [],
|
||||||
|
src: $A.mainUrl('images/avatar/default_claude.png'),
|
||||||
|
desc: $A.L('我是Claude,一个由Anthropic公司创造出来的AI助手机器人。我的工作是帮助人类,与人对话并给出解答。')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "deepseek",
|
||||||
|
label: "DeepSeek",
|
||||||
|
tags: [],
|
||||||
|
src: $A.mainUrl('images/avatar/default_deepseek.png'),
|
||||||
|
desc: $A.L('DeepSeek大语言模型算法是北京深度求索人工智能基础技术研究有限公司推出的深度合成服务算法。')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "gemini",
|
||||||
|
label: "Gemini",
|
||||||
|
tags: [],
|
||||||
|
src: $A.mainUrl('images/avatar/default_gemini.png'),
|
||||||
|
desc: `${$A.L('我是由Google开发的生成式人工智能聊天机器人。')}${$A.L('它基于同名的Gemini系列大型语言模型。')}${$A.L('是应对OpenAI公司开发的ChatGPT聊天机器人的崛起而开发的。')}`
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "grok",
|
||||||
|
label: "Grok",
|
||||||
|
tags: [],
|
||||||
|
src: $A.mainUrl('images/avatar/default_grok.png'),
|
||||||
|
desc: $A.L('Grok是由xAI开发的生成式人工智能聊天机器人,旨在通过实时回答用户问题来提供帮助。')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "ollama",
|
||||||
|
label: "Ollama",
|
||||||
|
tags: [],
|
||||||
|
src: $A.mainUrl('images/avatar/default_ollama.png'),
|
||||||
|
desc: $A.L('Ollama 是一个轻量级、可扩展的框架,旨在让用户能够在本地机器上构建和运行大型语言模型。')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "zhipu",
|
||||||
|
label: "智谱清言",
|
||||||
|
tags: [],
|
||||||
|
src: $A.mainUrl('images/avatar/default_zhipu.png'),
|
||||||
|
desc: `${$A.L('我是智谱清言,是智谱 AI 公司于2023训练的语言模型。')}${$A.L('我的任务是针对用户的问题和要求提供适当的答复和支持。')}`
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "qianwen",
|
||||||
|
label: "通义千问",
|
||||||
|
tags: [],
|
||||||
|
src: $A.mainUrl('avatar/%E9%80%9A%E4%B9%89%E5%8D%83%E9%97%AE.png'),
|
||||||
|
desc: $A.L('我是达摩院自主研发的超大规模语言模型,能够回答问题、创作文字,还能表达观点、撰写代码。')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "wenxin",
|
||||||
|
label: "文心一言",
|
||||||
|
tags: [],
|
||||||
|
src: $A.mainUrl('avatar/%E6%96%87%E5%BF%83.png'),
|
||||||
|
desc: $A.L('我是文心一言,英文名是ERNIE Bot。我能够与人对话互动,回答问题,协助创作,高效便捷地帮助人们获取信息、知识和灵感。')
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
const AISystemConfig = {
|
||||||
|
fields: [
|
||||||
|
{
|
||||||
|
label: "API Key",
|
||||||
|
prop: "key",
|
||||||
|
type: "password"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "模型列表",
|
||||||
|
prop: "models",
|
||||||
|
type: "textarea",
|
||||||
|
placeholder: "一行一个模型名称",
|
||||||
|
functions: "使用默认模型列表"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "默认模型",
|
||||||
|
prop: "model",
|
||||||
|
type: "model",
|
||||||
|
placeholder: "请选择默认模型",
|
||||||
|
tip: "可选数据来自模型列表"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Base URL",
|
||||||
|
prop: "base_url",
|
||||||
|
placeholder: "Enter base URL...",
|
||||||
|
tip: "API请求的基础URL路径,如果没有请留空"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "使用代理",
|
||||||
|
prop: "agency",
|
||||||
|
placeholder: '支持 http 或 socks 代理',
|
||||||
|
tip: "例如:http://proxy.com 或 socks5://proxy.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Temperature",
|
||||||
|
prop: "temperature",
|
||||||
|
placeholder: "模型温度,低则保守,高则多样",
|
||||||
|
tip: "例如:0.7,范围:0-1,默认:0.7"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "默认提示词",
|
||||||
|
prop: "system",
|
||||||
|
type: "textarea",
|
||||||
|
placeholder: "请输入默认提示词",
|
||||||
|
tip: "例如:你是一个人开发的AI助手"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
aiList: {
|
||||||
|
openai: {
|
||||||
|
extraFields: [
|
||||||
|
{
|
||||||
|
prop: "key",
|
||||||
|
placeholder: "OpenAI API Key",
|
||||||
|
link: "https://platform.openai.com/account/api-keys"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: "models",
|
||||||
|
link: "https://platform.openai.com/docs/models",
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
claude: {
|
||||||
|
extraFields: [
|
||||||
|
{
|
||||||
|
prop: "key",
|
||||||
|
placeholder: "Claude API Key",
|
||||||
|
link: "https://docs.anthropic.com/en/api/getting-started"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: "models",
|
||||||
|
link: "https://docs.anthropic.com/en/docs/about-claude/models"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
deepseek: {
|
||||||
|
extraFields: [
|
||||||
|
{
|
||||||
|
prop: "key",
|
||||||
|
placeholder: "DeepSeek API Key",
|
||||||
|
link: "https://platform.deepseek.com/api_keys"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: "models",
|
||||||
|
link: "https://api-docs.deepseek.com/zh-cn/quick_start/pricing"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
gemini: {
|
||||||
|
extraFields: [
|
||||||
|
{
|
||||||
|
prop: "key",
|
||||||
|
placeholder: "Gemini API Key",
|
||||||
|
link: "https://makersuite.google.com/app/apikey"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: "models",
|
||||||
|
link: "https://ai.google.dev/models/gemini"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: "agency",
|
||||||
|
placeholder: "仅支持 http 代理",
|
||||||
|
tip: "例如:http://proxy.com"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
grok: {
|
||||||
|
extraFields: [
|
||||||
|
{
|
||||||
|
prop: "key",
|
||||||
|
placeholder: "Grok API Key",
|
||||||
|
link: "https://docs.x.ai/docs/tutorial"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: "models",
|
||||||
|
link: "https://docs.x.ai/docs/models"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
ollama: {
|
||||||
|
extraFields: [
|
||||||
|
{
|
||||||
|
prop: "key",
|
||||||
|
placeholder: "Ollama API Key",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: "models",
|
||||||
|
link: "https://ollama.com/models",
|
||||||
|
functions: null,
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
zhipu: {
|
||||||
|
extraFields: [
|
||||||
|
{
|
||||||
|
prop: "key",
|
||||||
|
placeholder: "Zhipu API Key",
|
||||||
|
link: "https://bigmodel.cn/usercenter/apikeys"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: "models",
|
||||||
|
link: "https://open.bigmodel.cn/dev/api"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
qianwen: {
|
||||||
|
extraFields: [
|
||||||
|
{
|
||||||
|
prop: "key",
|
||||||
|
placeholder: "Qianwen API Key",
|
||||||
|
link: "https://help.aliyun.com/zh/model-studio/developer-reference/get-api-key"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: "models",
|
||||||
|
link: "https://help.aliyun.com/zh/model-studio/getting-started/models"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
wenxin: {
|
||||||
|
extraFields: [
|
||||||
|
{
|
||||||
|
prop: "key",
|
||||||
|
placeholder: "Wenxin API Key",
|
||||||
|
link: "https://console.bce.baidu.com/qianfan/ais/console/applicationConsole/application/v1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: "secret",
|
||||||
|
placeholder: "Wenxin Secret Key",
|
||||||
|
link: "https://console.bce.baidu.com/qianfan/ais/console/applicationConsole/application/v1",
|
||||||
|
type: "password",
|
||||||
|
label: "Secret Key",
|
||||||
|
after: "key"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop: "models",
|
||||||
|
link: "https://cloud.baidu.com/doc/WENXINWORKSHOP/s/Blfmc9dlf"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export {AIModelNames, AIBotList, AISystemConfig}
|
||||||
11
resources/assets/sass/pages/page-apply.scss
vendored
11
resources/assets/sass/pages/page-apply.scss
vendored
@ -241,11 +241,16 @@
|
|||||||
max-width: 100vw;
|
max-width: 100vw;
|
||||||
|
|
||||||
.ivu-modal-wrap-apply-title {
|
.ivu-modal-wrap-apply-title {
|
||||||
line-height: 40px;
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
z-index: 10;
|
||||||
|
margin: 0 20px;
|
||||||
|
padding: 12px 10px;
|
||||||
|
background: #ffffff;
|
||||||
|
color: #303133;
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
padding: 12px 30px;
|
line-height: 40px;
|
||||||
color: #303133;
|
|
||||||
|
|
||||||
> p {
|
> p {
|
||||||
float: right;
|
float: right;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user