mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 01:06:59 +08:00
perf: API Optimization for Multi-Domain Validation in Embedded Advanced Assistants
This commit is contained in:
committed by
fit2cloud-chenyw
parent
282d94f8bb
commit
aa0b31991e
@@ -1,4 +1,5 @@
|
||||
import json
|
||||
import re
|
||||
import urllib
|
||||
from typing import Optional
|
||||
|
||||
@@ -142,15 +143,20 @@ class AssistantOutDs:
|
||||
raise Exception(f"Failed to get datasource list from {endpoint}, error: {result_json.get('message')}")
|
||||
else:
|
||||
raise Exception(f"Failed to get datasource list from {endpoint}, status code: {res.status_code}")
|
||||
|
||||
|
||||
def get_first_element(self, text: str):
|
||||
parts = re.split(r'[,;]', text.strip())
|
||||
first_domain = parts[0].strip()
|
||||
return first_domain
|
||||
|
||||
def get_complete_endpoint(self, endpoint: str) -> str | None:
|
||||
if endpoint.startswith("http://") or endpoint.startswith("https://"):
|
||||
return endpoint
|
||||
domain_text = self.assistant.domain
|
||||
if not domain_text:
|
||||
return None
|
||||
if ',' in domain_text:
|
||||
return (self.request_origin.strip('/') if self.request_origin else domain_text.split(',')[0].strip('/')) + endpoint
|
||||
if ',' in domain_text or ';' in domain_text:
|
||||
return (self.request_origin.strip('/') if self.request_origin else self.get_first_element(domain_text).strip('/')) + endpoint
|
||||
else:
|
||||
return f"{domain_text}{endpoint}"
|
||||
|
||||
|
||||
@@ -764,7 +764,8 @@
|
||||
"ou_placeholder": "Example: ou=users,dc=example,dc=com",
|
||||
"user_filter": "User Filter",
|
||||
"user_filter_placeholder": "Example: uid",
|
||||
"ldap_field_mapping_placeholder": "Example: {\"account\": \"ldapAccount\", \"name\": \"ldapName\", \"email\": \"mail\"}"
|
||||
"ldap_field_mapping_placeholder": "Example: {\"account\": \"ldapAccount\", \"name\": \"ldapName\", \"email\": \"mail\"}",
|
||||
"be_turned_on": "Once the test connection is confirmed to be effective, it can be enabled"
|
||||
},
|
||||
"login": {
|
||||
"default_login": "Default",
|
||||
|
||||
@@ -764,7 +764,8 @@
|
||||
"ou_placeholder": "예: ou=users,dc=example,dc=com",
|
||||
"user_filter": "사용자 필터",
|
||||
"user_filter_placeholder": "예: uid",
|
||||
"ldap_field_mapping_placeholder": "예: {\"account\": \"ldapAccount\", \"name\": \"ldapName\", \"email\": \"mail\"}"
|
||||
"ldap_field_mapping_placeholder": "예: {\"account\": \"ldapAccount\", \"name\": \"ldapName\", \"email\": \"mail\"}",
|
||||
"be_turned_on": "테스트 연결이 유효한 것으로 확인되면 활성화할 수 있습니다"
|
||||
},
|
||||
"login": {
|
||||
"default_login": "기본값",
|
||||
|
||||
@@ -764,7 +764,8 @@
|
||||
"ou_placeholder": "例如:ou=users,dc=example,dc=com",
|
||||
"user_filter": "用户过滤器",
|
||||
"user_filter_placeholder": "例如:uid",
|
||||
"ldap_field_mapping_placeholder": "例如:{'{'}\"account\": \"ldapAccount\", \"name\": \"ldapName\", \"email\": \"mail\"{'}'}"
|
||||
"ldap_field_mapping_placeholder": "例如:{'{'}\"account\": \"ldapAccount\", \"name\": \"ldapName\", \"email\": \"mail\"{'}'}",
|
||||
"be_turned_on": "测试连接有效后,可开启"
|
||||
},
|
||||
"login": {
|
||||
"default_login": "默认",
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
v-if="!item.valid"
|
||||
class="box-item"
|
||||
effect="dark"
|
||||
:content="t('system.be_turned_on')"
|
||||
:content="t('authentication.be_turned_on')"
|
||||
placement="top"
|
||||
>
|
||||
<el-switch
|
||||
|
||||
Reference in New Issue
Block a user