Skip to content

Commit

Permalink
fix: loal file api error (#3637)
Browse files Browse the repository at this point in the history
* update doc

* fix: loal file api error

* fix: number input import

* feat: icon load
  • Loading branch information
c121914yu authored Jan 21, 2025
1 parent 3c97757 commit 946bd20
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 94 deletions.
39 changes: 5 additions & 34 deletions docSite/content/zh-cn/docs/development/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,45 +26,16 @@ images: []
### sealos怎么挂载 小程序配置文件

新增配置文件:/app/projects/app/public/xxxx.txt
如图

如图:

![](/imgs/faq2.png)

### 数据库3306端口被占用了,启动服务失败
![](/imgs/faq3.png)

mysql 只有 oneAPI 用到,外面一般不需要调用,所以可以
- 把 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 # 改成外面的链接字符串
```
![](/imgs/faq3.png)

把端口映射改成 3307 之类的,例如 3307:3306。

### 本地部署的限制

Expand Down
4 changes: 3 additions & 1 deletion docSite/content/zh-cn/docs/development/upgrading/4819.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ weight: 806
7. 修复 - 语雀文件库导入时,嵌套文件内容无法展开的问题。
8. 修复 - 工作流编排中,LLM 参数无法关闭问题。
9. 修复 - 工作流编排中,代码运行节点还原模板问题。
10. 修复 - HTTP 接口适配对象字符串解析。
10. 修复 - HTTP 接口适配对象字符串解析。
11. 修复 - 通过 API 上传文件(localFile)接口,图片过期标记未清除。
12. 修复 - 工作流导入编排时,number input 类型无法覆盖。
10 changes: 2 additions & 8 deletions docSite/content/zh-cn/docs/faq/other.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ weight: 918

只有开源的 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)
开源版未支持多用户,仅商业版支持。
14 changes: 12 additions & 2 deletions packages/web/components/common/Icon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,23 @@ import { Box, Icon } from '@chakra-ui/react';
import { iconPaths } from './constants';
import type { IconNameType } from './type.d';

const iconCache: Record<string, any> = {};

const MyIcon = ({ name, w = 'auto', h = 'auto', ...props }: { name: IconNameType } & IconProps) => {
const [IconComponent, setIconComponent] = useState<any>(null);

useEffect(() => {
if (iconCache[name]) {
setIconComponent(iconCache[name]);
return;
}

iconPaths[name]?.()
.then((icon) => {
setIconComponent({ as: icon.default });
const component = { as: icon.default };
// Store in cache
iconCache[name] = component;
setIconComponent(component);
})
.catch((error) => console.log(error));
}, [name]);
Expand All @@ -30,4 +40,4 @@ const MyIcon = ({ name, w = 'auto', h = 'auto', ...props }: { name: IconNameType
);
};

export default React.memo(MyIcon);
export default MyIcon;
15 changes: 6 additions & 9 deletions projects/app/src/components/core/ai/ModelTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import SearchInput from '@fastgpt/web/components/common/Input/SearchInput';
import { useSystemStore } from '@/web/common/system/useSystemStore';
import Avatar from '@fastgpt/web/components/common/Avatar';
import MyTag from '@fastgpt/web/components/common/Tag/index';
import MyTooltip from '@fastgpt/web/components/common/MyTooltip';
import dynamic from 'next/dynamic';

const MyModal = dynamic(() => import('@fastgpt/web/components/common/MyModal'));
Expand Down Expand Up @@ -237,15 +236,13 @@ const ModelTable = () => {
</Tr>
</Thead>
<Tbody>
{modelList.map((item) => (
<Tr key={item.name} _hover={{ bg: 'myGray.50' }}>
{modelList.map((item, index) => (
<Tr key={index} _hover={{ bg: 'myGray.50' }}>
<Td fontSize={'sm'}>
<MyTooltip title={item.providerName}>
<HStack>
<Avatar src={item.avatar} w={'1.2rem'} />
<Box color={'myGray.900'}>{item.name}</Box>
</HStack>
</MyTooltip>
<HStack>
<Avatar src={item.avatar} w={'1.2rem'} />
<Box color={'myGray.900'}>{item.name}</Box>
</HStack>
</Td>
<Td>
<MyTag colorSchema={item.tagColor as any}>{item.typeLabel}</MyTag>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse<any>): CreateCo
const { collectionId, insertResults } = await createCollectionAndInsertData({
dataset,
rawText,
relatedId: fileId,
relatedId: relatedImgId,
createCollectionParams: {
...collectionData,
name: collectionName,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
import React, { useMemo } from 'react';
import type { RenderInputProps } from '../type';
import {
NumberDecrementStepper,
NumberIncrementStepper,
NumberInput,
NumberInputField,
NumberInputStepper
} from '@chakra-ui/react';
import { useContextSelector } from 'use-context-selector';
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 onChangeNode = useContextSelector(WorkflowContext, (v) => v.onChangeNode);

const Render = useMemo(() => {
return (
<NumberInput
defaultValue={item.value}
<MyNumberInput
value={item.value}
min={item.min}
max={item.max}
bg={'white'}
Expand All @@ -29,38 +22,11 @@ const NumberInputRender = ({ item, nodeId }: RenderInputProps) => {
key: item.key,
value: {
...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]);

Expand Down

0 comments on commit 946bd20

Please sign in to comment.