feat: Refactor tenant configuration management to use KV API

- Updated tenant web search and agent configuration endpoints to utilize a KV-style API for better flexibility.
- Enhanced the tenant handler to support generic key-value operations for retrieving and updating configurations.
- Improved frontend API calls to align with the new KV API structure, ensuring consistent data handling.
- Removed deprecated direct configuration endpoints for a cleaner and more maintainable codebase.
This commit is contained in:
wizardchen
2025-11-10 20:11:45 +08:00
parent 07a8c1de4c
commit ac8c8e9af2
8 changed files with 201 additions and 178 deletions
+2 -2
View File
@@ -38,9 +38,9 @@ export function getSystemInfo(): Promise<{ data: SystemInfo }> {
}
export function getAgentConfig(): Promise<{ data: AgentConfig }> {
return get('/api/v1/tenants/agent-config')
return get('/api/v1/tenants/kv/agent-config')
}
export function updateAgentConfig(config: AgentConfig): Promise<{ data: AgentConfig }> {
return put('/api/v1/tenants/agent-config', config)
return put('/api/v1/tenants/kv/agent-config', config)
}
+4 -4
View File
@@ -29,13 +29,13 @@ export function getWebSearchProviders() {
return get('/api/v1/web-search/providers')
}
// Get tenant web search config
// Get tenant web search config via KV API
export function getTenantWebSearchConfig() {
return get('/api/v1/tenants/web-search-config')
return get('/api/v1/tenants/kv/web-search-config')
}
// Update tenant web search config
// Update tenant web search config via KV API
export function updateTenantWebSearchConfig(config: WebSearchConfig) {
return put('/api/v1/tenants/web-search-config', config)
return put('/api/v1/tenants/kv/web-search-config', config)
}
@@ -31,11 +31,6 @@
<div class="provider-option-wrapper">
<div class="provider-option">
<span class="provider-name">{{ provider.name }}</span>
<div class="provider-tags">
<t-tag v-if="provider.free" size="small" theme="success">免费</t-tag>
<t-tag v-else size="small" theme="warning">付费</t-tag>
<t-tag v-if="provider.requires_api_key" size="small" theme="default">需API密钥</t-tag>
</div>
</div>
<div v-if="provider.description" class="provider-desc">
{{ provider.description }}
@@ -401,5 +396,35 @@ onMounted(async () => {
line-height: 1.4;
margin-top: 2px;
}
/* 修复下拉项描述与条目重叠:让选项支持多行自适应高度 */
:deep(.t-select-option) {
height: auto;
align-items: flex-start;
padding-top: 6px;
padding-bottom: 6px;
}
:deep(.t-select-option__content) {
white-space: normal;
}
</style>
<style lang="less">
.t-select__dropdown .t-select-option {
height: auto;
align-items: flex-start;
padding-top: 6px;
padding-bottom: 6px;
}
.t-select__dropdown .t-select-option__content {
white-space: normal;
}
.t-select__dropdown .provider-option-wrapper {
display: flex;
flex-direction: column;
gap: 4px;
padding: 2px 0;
}
</style>