mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 17:26:55 +08:00
Merge branch 'main' of https://github.com/dataease/SQLBot
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 4.6 KiB |
@@ -8,18 +8,25 @@ import icon_openai_colorful from '@/assets/model/icon_openai_colorful.png'
|
||||
import icon_kimi_colorful from '@/assets/model/icon_kimi_colorful.png'
|
||||
import icon_txhy_colorful from '@/assets/model/icon_txhy_colorful.png'
|
||||
import icon_hsyq_colorful from '@/assets/model/icon_hsyq_colorful.png'
|
||||
import icon_vllm_colorful from '@/assets/model/icon_vllm_colorful.png'
|
||||
|
||||
type ModelArg = { key: string; val?: string | number; type: string; range?: string }
|
||||
type ModelOption = { name: string; api_domain?: string; args?: ModelArg[] }
|
||||
type ModelConfig = Record<
|
||||
number,
|
||||
{ api_domain: string; common_args?: ModelArg[]; model_options: ModelOption[] }
|
||||
{
|
||||
api_domain: string
|
||||
common_args?: ModelArg[]
|
||||
model_options: ModelOption[]
|
||||
}
|
||||
>
|
||||
|
||||
export const supplierList: Array<{
|
||||
id: number
|
||||
name: string
|
||||
icon: any
|
||||
type?: string
|
||||
is_private?: boolean
|
||||
model_config: ModelConfig
|
||||
}> = [
|
||||
{
|
||||
@@ -259,6 +266,20 @@ export const supplierList: Array<{
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 11,
|
||||
name: 'vLLM',
|
||||
icon: icon_vllm_colorful,
|
||||
type: 'vllm',
|
||||
is_private: true,
|
||||
model_config: {
|
||||
0: {
|
||||
api_domain: 'http://127.0.0.1:8000/v1',
|
||||
common_args: [{ key: 'temperature', val: 0.6, type: 'number', range: '[0, 1]' }],
|
||||
model_options: [],
|
||||
},
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
export const base_model_options = (supplier_id: number, model_type?: number) => {
|
||||
|
||||
@@ -38,6 +38,7 @@ const modelForm = reactive({
|
||||
api_key: '',
|
||||
api_domain: '',
|
||||
config_list: [],
|
||||
protocol: 1,
|
||||
})
|
||||
const isCreate = ref(false)
|
||||
const modelRef = ref()
|
||||
@@ -90,7 +91,7 @@ const handleCurrentChange = (val: any) => {
|
||||
currentPage.value = val
|
||||
}
|
||||
|
||||
const rules = {
|
||||
const rules = computed(() => ({
|
||||
model_type: [
|
||||
{
|
||||
required: true,
|
||||
@@ -109,12 +110,12 @@ const rules = {
|
||||
name: [{ required: true, message: t('model.the_basic_model'), trigger: 'blur' }],
|
||||
api_key: [
|
||||
{
|
||||
required: true,
|
||||
required: !currentSupplier.value?.is_private,
|
||||
message: t('datasource.please_enter') + t('common.empty') + 'API Key',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
}
|
||||
}))
|
||||
|
||||
onMounted(() => {
|
||||
setTimeout(() => {
|
||||
@@ -169,6 +170,7 @@ const supplierChang = (supplier: any) => {
|
||||
const config = supplier.model_config[modelForm.model_type || 0]
|
||||
modelForm.api_domain = config.api_domain
|
||||
modelForm.base_model = ''
|
||||
modelForm.protocol = supplier.type === 'vllm' ? 2 : 1
|
||||
advancedSetting.value = []
|
||||
}
|
||||
let curId = +new Date()
|
||||
@@ -201,7 +203,7 @@ const formatAdvancedSetting = (list: Array<any>) => {
|
||||
advancedSetting.value = setting_list
|
||||
}
|
||||
const baseModelChange = (val: string) => {
|
||||
if (!val || !modelForm.supplier || !modelList.value?.length) {
|
||||
if (!val || !modelForm.supplier) {
|
||||
return
|
||||
}
|
||||
const current_model = modelList.value?.find((model: any) => model.name == val)
|
||||
|
||||
Reference in New Issue
Block a user