perf: ai proxy (#4265)

* sync collection

* remove lock

* perf: ai proxy
This commit is contained in:
Archer
2025-03-21 14:03:54 +08:00
committed by archer
parent 9918133426
commit 2c73e9dc12
2 changed files with 20 additions and 10 deletions

View File

@@ -19,6 +19,7 @@ weight: 799
1. 导出对话日志时,支持导出成员名。
2. 邀请链接交互。
3. 无 SSL 证书时复制失败,会提示弹窗用于手动复制。
4. FastGPT 未内置 ai proxy 渠道时,也能正常展示其名称。
## 🐛 修复

View File

@@ -1,4 +1,10 @@
import { deleteChannel, getChannelList, putChannel, putChannelStatus } from '@/web/core/ai/channel';
import {
deleteChannel,
getChannelList,
getChannelProviders,
putChannel,
putChannelStatus
} from '@/web/core/ai/channel';
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
import React, { useState } from 'react';
import {
@@ -50,6 +56,10 @@ const ChannelTable = ({ Tab }: { Tab: React.ReactNode }) => {
manual: false
});
const { data: channelProviders = {} } = useRequest2(getChannelProviders, {
manual: false
});
const [editChannel, setEditChannel] = useState<ChannelInfoType>();
const { runAsync: updateChannel, loading: loadingUpdateChannel } = useRequest2(putChannel, {
@@ -111,7 +121,10 @@ const ChannelTable = ({ Tab }: { Tab: React.ReactNode }) => {
</Thead>
<Tbody>
{channelList.map((item) => {
const providerData = aiproxyIdMap[item.type];
const providerData = aiproxyIdMap[item.type] || {
label: channelProviders[item.type]?.name || 'Invalid provider',
provider: 'Other'
};
const provider = getModelProvider(providerData?.provider);
return (
@@ -119,14 +132,10 @@ const ChannelTable = ({ Tab }: { Tab: React.ReactNode }) => {
<Td>{item.id}</Td>
<Td>{item.name}</Td>
<Td>
{providerData ? (
<HStack>
<MyIcon name={provider?.avatar as any} w={'1rem'} />
<Box>{t(providerData?.label as any)}</Box>
</HStack>
) : (
'Invalid provider'
)}
</Td>
<Td>
<MyTag