mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-21 11:43:56 +00:00
perf: ai proxy (#4265)
* sync collection * remove lock * perf: ai proxy
This commit is contained in:
@@ -19,6 +19,7 @@ weight: 799
|
|||||||
1. 导出对话日志时,支持导出成员名。
|
1. 导出对话日志时,支持导出成员名。
|
||||||
2. 邀请链接交互。
|
2. 邀请链接交互。
|
||||||
3. 无 SSL 证书时复制失败,会提示弹窗用于手动复制。
|
3. 无 SSL 证书时复制失败,会提示弹窗用于手动复制。
|
||||||
|
4. FastGPT 未内置 ai proxy 渠道时,也能正常展示其名称。
|
||||||
|
|
||||||
## 🐛 修复
|
## 🐛 修复
|
||||||
|
|
||||||
|
@@ -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 { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import {
|
import {
|
||||||
@@ -50,6 +56,10 @@ const ChannelTable = ({ Tab }: { Tab: React.ReactNode }) => {
|
|||||||
manual: false
|
manual: false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const { data: channelProviders = {} } = useRequest2(getChannelProviders, {
|
||||||
|
manual: false
|
||||||
|
});
|
||||||
|
|
||||||
const [editChannel, setEditChannel] = useState<ChannelInfoType>();
|
const [editChannel, setEditChannel] = useState<ChannelInfoType>();
|
||||||
|
|
||||||
const { runAsync: updateChannel, loading: loadingUpdateChannel } = useRequest2(putChannel, {
|
const { runAsync: updateChannel, loading: loadingUpdateChannel } = useRequest2(putChannel, {
|
||||||
@@ -111,7 +121,10 @@ const ChannelTable = ({ Tab }: { Tab: React.ReactNode }) => {
|
|||||||
</Thead>
|
</Thead>
|
||||||
<Tbody>
|
<Tbody>
|
||||||
{channelList.map((item) => {
|
{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);
|
const provider = getModelProvider(providerData?.provider);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -119,14 +132,10 @@ const ChannelTable = ({ Tab }: { Tab: React.ReactNode }) => {
|
|||||||
<Td>{item.id}</Td>
|
<Td>{item.id}</Td>
|
||||||
<Td>{item.name}</Td>
|
<Td>{item.name}</Td>
|
||||||
<Td>
|
<Td>
|
||||||
{providerData ? (
|
<HStack>
|
||||||
<HStack>
|
<MyIcon name={provider?.avatar as any} w={'1rem'} />
|
||||||
<MyIcon name={provider?.avatar as any} w={'1rem'} />
|
<Box>{t(providerData?.label as any)}</Box>
|
||||||
<Box>{t(providerData?.label as any)}</Box>
|
</HStack>
|
||||||
</HStack>
|
|
||||||
) : (
|
|
||||||
'Invalid provider'
|
|
||||||
)}
|
|
||||||
</Td>
|
</Td>
|
||||||
<Td>
|
<Td>
|
||||||
<MyTag
|
<MyTag
|
||||||
|
Reference in New Issue
Block a user