fix: loal file api error (#3637)

* update doc

* fix: loal file api error

* fix: number input import

* feat: icon load
This commit is contained in:
Archer 2025-01-21 16:46:49 +08:00 committed by GitHub
parent 3c97757e4d
commit 946bd20dbf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 34 additions and 94 deletions

View File

@ -26,45 +26,16 @@ images: []
### sealos怎么挂载 小程序配置文件 ### sealos怎么挂载 小程序配置文件
新增配置文件:/app/projects/app/public/xxxx.txt 新增配置文件:/app/projects/app/public/xxxx.txt
如图
如图:
![](/imgs/faq2.png) ![](/imgs/faq2.png)
### 数据库3306端口被占用了启动服务失败 ### 数据库3306端口被占用了启动服务失败
![](/imgs/faq3.png) ![](/imgs/faq3.png)
mysql 只有 oneAPI 用到,外面一般不需要调用,所以可以 把端口映射改成 3307 之类的,例如 3307:3306。
- 把 3306:3306 的映射去掉/或者直接改一个映射。
```yaml
# 在 docker-compose.yaml 文件内
# ...
mysql:
image: mysql:8.0.36
ports:
- 3306:3306 # 这个端口被占用了!
# - 3307:3306 # 直接改一个。。和外面的不冲突
# *empty* 或者直接删了,反正外面用不到
oneapi:
container_name: oneapi
image: ghcr.io/songquanpeng/one-api:latest
environment:
- SQL_DSN=root:oneapimmysql@tcp(mysql:3306)/oneapi # 这不用改,容器内外网络是隔离的
```
- 另一种做法是可以直接连现有的 mysql 要改 oneAPI 的环境变量。
```yaml
# 在 docker-compose.yaml 文件内
# ...
# mysql: # 要连外面的,这个玩意用不到了
# image: mysql:8.0.36
# ports:
# - 3306:3306 # 这个端口被占用了!
oneapi:
container_name: oneapi
image: ghcr.io/songquanpeng/one-api:latest
environment:
- SQL_DSN=root:oneapimmysql@tcp(mysql:3306)/oneapi # 改成外面的链接字符串
```
### 本地部署的限制 ### 本地部署的限制

View File

@ -20,3 +20,5 @@ weight: 806
8. 修复 - 工作流编排中LLM 参数无法关闭问题。 8. 修复 - 工作流编排中LLM 参数无法关闭问题。
9. 修复 - 工作流编排中,代码运行节点还原模板问题。 9. 修复 - 工作流编排中,代码运行节点还原模板问题。
10. 修复 - HTTP 接口适配对象字符串解析。 10. 修复 - HTTP 接口适配对象字符串解析。
11. 修复 - 通过 API 上传文件localFile接口图片过期标记未清除。
12. 修复 - 工作流导入编排时number input 类型无法覆盖。

View File

@ -10,12 +10,6 @@ weight: 918
只有开源的 README没官网GitHub: https://github.com/songquanpeng/one-api 只有开源的 README没官网GitHub: https://github.com/songquanpeng/one-api
## 想做多用户和多chat key ## 想做多用户
![](/imgs/other1.png) 开源版未支持多用户,仅商业版支持。
![](/imgs/other2.png)
多用户问题:只能采取二开或者商业版
多chat key问题1. 私有化部署情况下oneapi解决。2. Saas或者商业版中可以为每个团队设置单独的key。
![](/imgs/other3.png)

View File

@ -4,13 +4,23 @@ import { Box, Icon } from '@chakra-ui/react';
import { iconPaths } from './constants'; import { iconPaths } from './constants';
import type { IconNameType } from './type.d'; import type { IconNameType } from './type.d';
const iconCache: Record<string, any> = {};
const MyIcon = ({ name, w = 'auto', h = 'auto', ...props }: { name: IconNameType } & IconProps) => { const MyIcon = ({ name, w = 'auto', h = 'auto', ...props }: { name: IconNameType } & IconProps) => {
const [IconComponent, setIconComponent] = useState<any>(null); const [IconComponent, setIconComponent] = useState<any>(null);
useEffect(() => { useEffect(() => {
if (iconCache[name]) {
setIconComponent(iconCache[name]);
return;
}
iconPaths[name]?.() iconPaths[name]?.()
.then((icon) => { .then((icon) => {
setIconComponent({ as: icon.default }); const component = { as: icon.default };
// Store in cache
iconCache[name] = component;
setIconComponent(component);
}) })
.catch((error) => console.log(error)); .catch((error) => console.log(error));
}, [name]); }, [name]);
@ -30,4 +40,4 @@ const MyIcon = ({ name, w = 'auto', h = 'auto', ...props }: { name: IconNameType
); );
}; };
export default React.memo(MyIcon); export default MyIcon;

View File

@ -25,7 +25,6 @@ import SearchInput from '@fastgpt/web/components/common/Input/SearchInput';
import { useSystemStore } from '@/web/common/system/useSystemStore'; import { useSystemStore } from '@/web/common/system/useSystemStore';
import Avatar from '@fastgpt/web/components/common/Avatar'; import Avatar from '@fastgpt/web/components/common/Avatar';
import MyTag from '@fastgpt/web/components/common/Tag/index'; import MyTag from '@fastgpt/web/components/common/Tag/index';
import MyTooltip from '@fastgpt/web/components/common/MyTooltip';
import dynamic from 'next/dynamic'; import dynamic from 'next/dynamic';
const MyModal = dynamic(() => import('@fastgpt/web/components/common/MyModal')); const MyModal = dynamic(() => import('@fastgpt/web/components/common/MyModal'));
@ -237,15 +236,13 @@ const ModelTable = () => {
</Tr> </Tr>
</Thead> </Thead>
<Tbody> <Tbody>
{modelList.map((item) => ( {modelList.map((item, index) => (
<Tr key={item.name} _hover={{ bg: 'myGray.50' }}> <Tr key={index} _hover={{ bg: 'myGray.50' }}>
<Td fontSize={'sm'}> <Td fontSize={'sm'}>
<MyTooltip title={item.providerName}> <HStack>
<HStack> <Avatar src={item.avatar} w={'1.2rem'} />
<Avatar src={item.avatar} w={'1.2rem'} /> <Box color={'myGray.900'}>{item.name}</Box>
<Box color={'myGray.900'}>{item.name}</Box> </HStack>
</HStack>
</MyTooltip>
</Td> </Td>
<Td> <Td>
<MyTag colorSchema={item.tagColor as any}>{item.typeLabel}</MyTag> <MyTag colorSchema={item.tagColor as any}>{item.typeLabel}</MyTag>

View File

@ -73,7 +73,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse<any>): CreateCo
const { collectionId, insertResults } = await createCollectionAndInsertData({ const { collectionId, insertResults } = await createCollectionAndInsertData({
dataset, dataset,
rawText, rawText,
relatedId: fileId, relatedId: relatedImgId,
createCollectionParams: { createCollectionParams: {
...collectionData, ...collectionData,
name: collectionName, name: collectionName,

View File

@ -1,23 +1,16 @@
import React, { useMemo } from 'react'; import React, { useMemo } from 'react';
import type { RenderInputProps } from '../type'; import type { RenderInputProps } from '../type';
import {
NumberDecrementStepper,
NumberIncrementStepper,
NumberInput,
NumberInputField,
NumberInputStepper
} from '@chakra-ui/react';
import { useContextSelector } from 'use-context-selector'; import { useContextSelector } from 'use-context-selector';
import { WorkflowContext } from '@/pages/app/detail/components/WorkflowComponents/context'; import { WorkflowContext } from '@/pages/app/detail/components/WorkflowComponents/context';
import MyIcon from '@fastgpt/web/components/common/Icon'; import MyNumberInput from '@fastgpt/web/components/common/Input/NumberInput';
const NumberInputRender = ({ item, nodeId }: RenderInputProps) => { const NumberInputRender = ({ item, nodeId }: RenderInputProps) => {
const onChangeNode = useContextSelector(WorkflowContext, (v) => v.onChangeNode); const onChangeNode = useContextSelector(WorkflowContext, (v) => v.onChangeNode);
const Render = useMemo(() => { const Render = useMemo(() => {
return ( return (
<NumberInput <MyNumberInput
defaultValue={item.value} value={item.value}
min={item.min} min={item.min}
max={item.max} max={item.max}
bg={'white'} bg={'white'}
@ -29,38 +22,11 @@ const NumberInputRender = ({ item, nodeId }: RenderInputProps) => {
key: item.key, key: item.key,
value: { value: {
...item, ...item,
value: Number(e) value: e
} }
}); });
}} }}
> />
<NumberInputField
bg={'white'}
px={3}
rounded={'md'}
_hover={{
borderColor: 'primary.500'
}}
/>
<NumberInputStepper roundedTopRight={'none'}>
<NumberIncrementStepper
borderTopRightRadius={'sm !important'}
_hover={{
bg: 'myGray.100'
}}
>
<MyIcon name={'core/chat/chevronUp'} width={'12px'} />
</NumberIncrementStepper>
<NumberDecrementStepper
borderBottomRightRadius={'sm !important'}
_hover={{
bg: 'myGray.100'
}}
>
<MyIcon name={'core/chat/chevronDown'} width={'12px'} />
</NumberDecrementStepper>
</NumberInputStepper>
</NumberInput>
); );
}, [item, nodeId, onChangeNode]); }, [item, nodeId, onChangeNode]);