Commit 0ede427a by Archer Committed by GitHub

fix: var selector (#5593)

* fix: var selector

* doc

* doc time

* doc time

* doc time

* doc time

* doc time

* doc time

* doc time
parent 85ea1174
...@@ -37,6 +37,7 @@ WORKDIR /app ...@@ -37,6 +37,7 @@ WORKDIR /app
COPY --from=builder /app/public ./public COPY --from=builder /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
COPY --from=builder --chown=nextjs:nodejs /app/data ./data
USER nextjs USER nextjs
ENV NEXT_TELEMETRY_DISABLED=1 ENV NEXT_TELEMETRY_DISABLED=1
......
...@@ -4,25 +4,9 @@ import { notFound } from 'next/navigation'; ...@@ -4,25 +4,9 @@ import { notFound } from 'next/navigation';
import NotFound from '@/components/docs/not-found'; import NotFound from '@/components/docs/not-found';
import { createRelativeLink } from 'fumadocs-ui/mdx'; import { createRelativeLink } from 'fumadocs-ui/mdx';
import { getMDXComponents } from '@/mdx-components'; import { getMDXComponents } from '@/mdx-components';
import fs from 'fs';
import path from 'path';
// 读取文档修改时间数据 // 在构建时导入静态数据
function getDocLastModifiedData(): Record<string, string> { import docLastModifiedData from '@/data/doc-last-modified.json';
try {
const dataPath = path.join(process.cwd(), 'data', 'doc-last-modified.json');
if (!fs.existsSync(dataPath)) {
return {};
}
const data = fs.readFileSync(dataPath, 'utf8');
return JSON.parse(data);
} catch (error) {
console.error('读取文档修改时间数据失败:', error);
return {};
}
}
export default async function Page({ export default async function Page({
params params
...@@ -32,16 +16,15 @@ export default async function Page({ ...@@ -32,16 +16,15 @@ export default async function Page({
const { lang, slug } = await params; const { lang, slug } = await params;
const page = source.getPage(slug, lang); const page = source.getPage(slug, lang);
// 如果页面不存在,调用 notFound()
if (!page || !page.data || !page.file) { if (!page || !page.data || !page.file) {
return <NotFound />; return <NotFound />;
} }
const MDXContent = page.data.body; const MDXContent = page.data.body;
// 获取文档的最后修改时间 // 使用构建时导入的静态数据
const docLastModifiedData = getDocLastModifiedData(); const filePath = `document/content/docs/${page.file.path}`;
const filePath = `content/docs/${page.file.path}`; // @ts-ignore
const lastModified = docLastModifiedData[filePath] || page.data.lastModified; const lastModified = docLastModifiedData[filePath] || page.data.lastModified;
return ( return (
......
--- ---
title: 'V4.12.0(包含升级脚本)' title: 'V4.12.0(包含升级脚本)'
description: 'FastGPT V4.12.0 更新说明' description: 'FastGPT V4.12.0 更新说明, 发布于 2025-8-11。'
--- ---
## 更新指南 ## 更新指南
......
--- ---
title: 'V4.12.1(包含升级脚本)' title: 'V4.12.1(包含升级脚本)'
description: 'FastGPT V4.12.1 更新说明' description: 'FastGPT V4.12.1 更新说明, 发布于 2025-8-18。'
--- ---
## 更新指南 ## 更新指南
......
--- ---
title: 'V4.12.2' title: 'V4.12.2'
description: 'FastGPT V4.12.2 更新说明' description: 'FastGPT V4.12.2 更新说明, 发布于 2025-8-26。'
--- ---
## 更新指南 ## 更新指南
### 1. 更新镜像: ### 1. 更新镜像:
- 更新 FastGPT 镜像tag: v4.12.2-fix - 更新 FastGPT 镜像tag: v4.12.2-fix3
- 更新 FastGPT 商业版镜像tag: v4.12.2-fix - 更新 FastGPT 商业版镜像tag: v4.12.2-fix3
- 更新 fastgpt-plugin 镜像 tag: v0.1.11 - 更新 fastgpt-plugin 镜像 tag: v0.1.11
- mcp_server 无需更新 - mcp_server 无需更新
- Sandbox 无需更新 - Sandbox 无需更新
......
...@@ -16,5 +16,6 @@ description: 'FastGPT V4.12.3 更新说明' ...@@ -16,5 +16,6 @@ description: 'FastGPT V4.12.3 更新说明'
1. 单团队模式下,如果用户离开,则无法重新进入团队。 1. 单团队模式下,如果用户离开,则无法重新进入团队。
2. 工作流文件上传默认打开,但输入侧未添加文件输出。 2. 工作流文件上传默认打开,但输入侧未添加文件输出。
3. 连续用户选择,分支无法正常运行。 3. 连续用户选择,分支无法正常运行。
4. 工作流,变量更新,数组选择器异常。
## 🔨 工具更新 ## 🔨 工具更新
...@@ -104,8 +104,8 @@ ...@@ -104,8 +104,8 @@
"document/content/docs/upgrading/4-11/4111.mdx": "2025-08-07T22:49:09+08:00", "document/content/docs/upgrading/4-11/4111.mdx": "2025-08-07T22:49:09+08:00",
"document/content/docs/upgrading/4-12/4120.mdx": "2025-08-12T22:45:19+08:00", "document/content/docs/upgrading/4-12/4120.mdx": "2025-08-12T22:45:19+08:00",
"document/content/docs/upgrading/4-12/4121.mdx": "2025-08-15T22:53:06+08:00", "document/content/docs/upgrading/4-12/4121.mdx": "2025-08-15T22:53:06+08:00",
"document/content/docs/upgrading/4-12/4122.mdx": "2025-08-27T00:31:33+08:00", "document/content/docs/upgrading/4-12/4122.mdx": "2025-09-04T21:37:57+08:00",
"document/content/docs/upgrading/4-12/4123.mdx": "2025-09-04T13:48:03+08:00", "document/content/docs/upgrading/4-12/4123.mdx": "2025-09-04T21:37:57+08:00",
"document/content/docs/upgrading/4-8/40.mdx": "2025-08-02T19:38:37+08:00", "document/content/docs/upgrading/4-8/40.mdx": "2025-08-02T19:38:37+08:00",
"document/content/docs/upgrading/4-8/41.mdx": "2025-08-02T19:38:37+08:00", "document/content/docs/upgrading/4-8/41.mdx": "2025-08-02T19:38:37+08:00",
"document/content/docs/upgrading/4-8/42.mdx": "2025-08-02T19:38:37+08:00", "document/content/docs/upgrading/4-8/42.mdx": "2025-08-02T19:38:37+08:00",
......
...@@ -177,7 +177,7 @@ const MultipleRowSelector = ({ ...@@ -177,7 +177,7 @@ const MultipleRowSelector = ({
renderList.find((item) => item.value === (modelData?.provider || 'Other')) ?? renderList.find((item) => item.value === (modelData?.provider || 'Other')) ??
renderList[renderList.length - 1]; renderList[renderList.length - 1];
provider.children.push({ provider?.children.push({
label: modelData.name, label: modelData.name,
value: modelData.model value: modelData.model
}); });
......
...@@ -147,7 +147,7 @@ const EditForm = ({ ...@@ -147,7 +147,7 @@ const EditForm = ({
}, },
[appForm.aiSettings.systemPrompt, setAppForm] [appForm.aiSettings.systemPrompt, setAppForm]
); );
console.log(appForm.chatConfig.fileSelectConfig);
return ( return (
<> <>
<Box> <Box>
......
...@@ -111,18 +111,19 @@ const NodeVariableUpdate = ({ data, selected }: NodeProps<FlowNodeItemType>) => ...@@ -111,18 +111,19 @@ const NodeVariableUpdate = ({ data, selected }: NodeProps<FlowNodeItemType>) =>
(item) => item.renderType === updateItem.renderType (item) => item.renderType === updateItem.renderType
); );
const onUpdateNewValue = (newValue: any) => { const onUpdateNewValue = (newValue?: ReferenceValueType | string) => {
if (isValidReferenceValueFormat(newValue)) { if (typeof newValue === 'string') {
onUpdateList( onUpdateList(
updateList.map((update, i) => updateList.map((update, i) =>
i === index ? { ...update, value: newValue as ReferenceItemValueType } : update i === index ? { ...update, value: ['', newValue] } : update
) )
); );
} else { } else if (
Array.isArray(newValue) &&
(isValidReferenceValueFormat(newValue) || newValue.every(isValidReferenceValueFormat))
) {
onUpdateList( onUpdateList(
updateList.map((update, i) => updateList.map((update, i) => (i === index ? { ...update, value: newValue } : update))
i === index ? { ...update, value: ['', newValue] } : update
)
); );
} }
}; };
......
...@@ -258,6 +258,10 @@ const MultipleReferenceSelector = ({ ...@@ -258,6 +258,10 @@ const MultipleReferenceSelector = ({
}); });
}, [getSelectValue, value]); }, [getSelectValue, value]);
const invalidList = useMemo(() => {
return formatList.filter((item) => item.nodeName && item.outputName);
}, [formatList]);
useEffect(() => { useEffect(() => {
// Adapt array type from old version // Adapt array type from old version
if (Array.isArray(value) && typeof value[0] === 'string') { if (Array.isArray(value) && typeof value[0] === 'string') {
...@@ -266,10 +270,6 @@ const MultipleReferenceSelector = ({ ...@@ -266,10 +270,6 @@ const MultipleReferenceSelector = ({
} }
}, [formatList, onSelect, value]); }, [formatList, onSelect, value]);
const invalidList = useMemo(() => {
return formatList.filter((item) => item.nodeName && item.outputName);
}, [formatList]);
const ArraySelector = useMemo(() => { const ArraySelector = useMemo(() => {
return ( return (
<MultipleRowArraySelect <MultipleRowArraySelect
...@@ -282,7 +282,7 @@ const MultipleReferenceSelector = ({ ...@@ -282,7 +282,7 @@ const MultipleReferenceSelector = ({
fontSize={'sm'} fontSize={'sm'}
_hover={{ _hover={{
'.delete': { '.delete': {
display: 'block' visibility: 'visible'
} }
}} }}
> >
...@@ -310,7 +310,7 @@ const MultipleReferenceSelector = ({ ...@@ -310,7 +310,7 @@ const MultipleReferenceSelector = ({
</Flex> </Flex>
<MyIcon <MyIcon
className="delete" className="delete"
display={'none'} visibility={'hidden'}
name={'common/closeLight'} name={'common/closeLight'}
w={'1rem'} w={'1rem'}
ml={1} ml={1}
...@@ -336,7 +336,9 @@ const MultipleReferenceSelector = ({ ...@@ -336,7 +336,9 @@ const MultipleReferenceSelector = ({
} }
value={value as any} value={value as any}
list={list} list={list}
onSelect={onSelect as any} onSelect={(e) => {
onSelect(e as any);
}}
popDirection={popDirection} popDirection={popDirection}
/> />
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment