1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-03-01 03:24:14 +08:00

feat: Added display of ollama proxy address (#7897)

This commit is contained in:
zhengkunwang 2025-02-18 15:00:33 +08:00 committed by GitHub
parent f3d85d1309
commit b0b6bf458f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 64 additions and 8 deletions

View File

@ -40,4 +40,5 @@ type OllamaBindDomainRes struct {
SSLID uint `json:"sslID"`
AllowIPs []string `json:"allowIPs"`
WebsiteID uint `json:"websiteID"`
ConnUrl string `json:"connUrl"`
}

View File

@ -279,6 +279,7 @@ func (u *AIToolService) GetBindDomain(req dto.OllamaBindDomainReq) (*dto.OllamaB
if website.WebsiteSSLID > 0 {
res.SSLID = website.WebsiteSSLID
}
res.ConnUrl = fmt.Sprintf("%s://%s", strings.ToLower(website.Protocol), website.PrimaryDomain)
res.AllowIPs = GetAllowIps(website)
return res, nil
}

View File

@ -106,5 +106,6 @@ export namespace AI {
sslID: number;
allowIPs: string[];
websiteID?: number;
connUrl: string;
}
}

View File

@ -2589,6 +2589,8 @@ const message = {
proxyHelper2: 'Limit IP access to prevent exposure on the public internet',
proxyHelper3: 'Enable streaming',
proxyHelper4: 'Once created, you can view and manage it in the website list',
proxyHelper5:
'After enabling, you can disable external access to the port in the App Store - Installed - Ollama - Parameters to improve security.',
},
};

View File

@ -2557,6 +2557,8 @@ const message = {
proxyHelper2: 'IP アクセスを制限しパブリックインターネットでの露出を防止',
proxyHelper3: 'ストリーミングを有効にする',
proxyHelper4: '作成後ウェブサイトリストで確認および管理できます',
proxyHelper5:
'有効にするとアプリストア - インストール済み - Ollama - パラメータでポートの外部アクセスを無効にしセキュリティを向上させることができます',
},
};
export default {

View File

@ -2519,6 +2519,8 @@ const message = {
proxyHelper2: 'IP 접근을 제한하여 공용 인터넷에서의 노출을 방지',
proxyHelper3: '스트리밍을 활성화',
proxyHelper4: '생성 , 웹사이트 목록에서 이를 보고 관리할 있습니다',
proxyHelper5:
'활성화한 , 스토어 - 설치됨 - Ollama - 매개변수에서 포트 외부 접근을 비활성화하여 보안을 강화할 있습니다.',
},
};

View File

@ -2618,6 +2618,8 @@ const message = {
proxyHelper2: 'Hadkan akses IP untuk mengelakkan pendedahan di internet awam',
proxyHelper3: 'Aktifkan penstriman',
proxyHelper4: 'Setelah selesai, anda boleh melihat dan mengurusnya dalam senarai laman web',
proxyHelper5:
'Selepas diaktifkan, anda boleh melumpuhkan akses luaran ke port dalam App Store - Dipasang - Ollama - Parameter untuk meningkatkan keselamatan.',
},
};

View File

@ -2605,6 +2605,8 @@ const message = {
cronJobHelper: 'Dispara alerta via SMS ao falhar na execução de tarefas',
licenseHelper: 'A versão profissional suporta alertas via SMS',
alertCountHelper: 'Frequência máxima diária de alertas',
proxyHelper5:
'Após ativar, você pode desabilitar o acesso externo à porta na Loja de Aplicativos - Instalados - Ollama - Parâmetros para melhorar a segurança.',
},
aitool: {
proxy: 'Melhoria de Proxy AI',

View File

@ -2611,6 +2611,8 @@ const message = {
proxyHelper2: 'Ограничьте доступ по IP, чтобы предотвратить утечку данных в публичной сети',
proxyHelper3: 'Включите потоковую передачу',
proxyHelper4: 'После создания вы можете просматривать и управлять этим в списке сайтов',
proxyHelper5:
'После включения вы можете отключить внешний доступ к порту в Магазине приложений - Установленные - Ollama - Параметры для повышения безопасности.',
},
};

View File

@ -2426,6 +2426,7 @@ const message = {
proxyHelper2: '限制 IP 訪問防止在公共網絡上暴露',
proxyHelper3: '啟用流式傳輸',
proxyHelper4: '創建後您可以在網站列表中查看並管理',
proxyHelper5: '啟用後您可以在應用商店 - 已安裝 - Ollama - 參數中取消端口外部訪問以提高安全性',
},
};
export default {

View File

@ -2428,6 +2428,7 @@ const message = {
proxyHelper2: '限制 IP 访问防止在公网暴露',
proxyHelper3: '开启流式传输',
proxyHelper4: '创建完成之后可以在网站列表中查看并管理',
proxyHelper5: '开启之后可以在应用商店 - 已安装 - ollama - 参数中取消端口外部访问以提高安全性',
},
};
export default {

View File

@ -29,7 +29,20 @@
{{ $t('ai_tools.model.container_conn_helper') }}
</span>
</el-form-item>
<el-form-item :label="$t('database.remoteConn')">
<el-form-item :label="$t('setting.proxyUrl')" v-if="bindDomain.connUrl != ''">
<el-card class="mini-border-card">
<el-descriptions :column="1">
<el-descriptions-item :label="$t('database.connAddress')">
{{ bindDomain.connUrl }}
<CopyButton :content="bindDomain.connUrl" type="icon" />
</el-descriptions-item>
</el-descriptions>
</el-card>
<span class="input-help">
{{ $t('database.remoteConnHelper2') }}
</span>
</el-form-item>
<el-form-item :label="$t('database.remoteConn')" v-else>
<el-card class="mini-border-card">
<el-descriptions :column="1">
<el-descriptions-item :label="$t('database.connAddress')">
@ -66,6 +79,7 @@ import i18n from '@/lang';
import { ElForm } from 'element-plus';
import DrawerHeader from '@/components/drawer-header/index.vue';
import { getSettingInfo } from '@/api/modules/setting';
import { getBindDomain } from '@/api/modules/ai';
const loading = ref(false);
@ -77,16 +91,21 @@ const form = reactive({
remoteIP: '',
});
const bindDomain = ref({
connUrl: '',
});
interface DialogProps {
port: number;
containerName: string;
appinstallID: number;
}
const acceptParams = (param: DialogProps): void => {
form.containerName = param.containerName;
form.port = param.port;
loadSystemIP();
loadBindDomain(param.appinstallID);
dialogVisible.value = true;
};
@ -99,6 +118,20 @@ const loadSystemIP = async () => {
form.systemIP = res.data.systemIP || i18n.global.t('database.localIP');
};
const loadBindDomain = async (appInstallID: number) => {
if (appInstallID == undefined || appInstallID <= 0) {
return;
}
try {
const res = await getBindDomain({
appInstallID: appInstallID,
});
if (res.data.websiteID > 0) {
bindDomain.value.connUrl = res.data.connUrl;
}
} catch (e) {}
};
defineExpose({
acceptParams,
});

View File

@ -24,6 +24,9 @@
</el-alert>
<el-form-item :label="$t('website.domain')" prop="domain">
<el-input v-model.trim="req.domain" :disabled="operate === 'update'" />
<span class="input-help">
{{ $t('aitool.proxyHelper4') }}
</span>
</el-form-item>
<el-form-item :label="$t('firewall.address')" prop="ipList">
<el-input
@ -82,7 +85,7 @@
</el-select>
</el-form-item>
<el-alert :closable="false">
{{ $t('aitool.proxyHelper4') }}
{{ $t('aitool.proxyHelper5') }}
</el-alert>
</el-col>
</el-row>

View File

@ -18,11 +18,7 @@
v-model:appInstallID="appInstallID"
@is-exist="checkExist"
ref="appStatusRef"
>
<template #extra>
<el-button link type="primary" @click="bindDomain">{{ $t('aitool.proxy') }}</el-button>
</template>
</AppStatus>
></AppStatus>
</template>
<template #toolbar v-if="modelInfo.isExist">
<div class="flex justify-between gap-2 flex-wrap sm:flex-row">
@ -45,6 +41,9 @@
>
OpenWebUI
</el-button>
<el-button plain type="primary" :disabled="modelInfo.status !== 'Running'" @click="bindDomain">
{{ $t('aitool.proxy') }}
</el-button>
<el-button plain :disabled="selects.length === 0" type="primary" @click="onDelete(null)">
{{ $t('commons.button.delete') }}
</el-button>
@ -279,7 +278,11 @@ const onSync = async () => {
};
const onLoadConn = async () => {
connRef.value.acceptParams({ port: modelInfo.port, containerName: modelInfo.container });
connRef.value.acceptParams({
port: modelInfo.port,
containerName: modelInfo.container,
appinstallID: appInstallID.value,
});
};
const onLoad = async (name: string) => {