Skip to content

Commit

Permalink
0.3.1 fix (#563)
Browse files Browse the repository at this point in the history
  • Loading branch information
zgqgit committed May 17, 2024
2 parents 4e8da2c + 9e8001a commit 3374e09
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docker/docker-compose-model.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ services:

bisheng-unstructured:
container_name: bisheng-unstructured
image: dataelement/bisheng-unstructured:0.0.3.4
image: dataelement/bisheng-unstructured:latest
ports:
- "10001:10001"
environment:
Expand Down
5 changes: 3 additions & 2 deletions src/backend/bisheng/api/services/flow.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import asyncio
import copy
from typing import List, Dict, AsyncGenerator

from fastapi.encoders import jsonable_encoder
Expand Down Expand Up @@ -243,11 +244,11 @@ async def get_compare_tasks(cls, user: UserPayload, req: FlowCompareReq) -> List
tasks = []
for index, question in enumerate(req.question_list):
question_index = index
tmp_inputs = req.inputs.copy()
tmp_inputs = copy.deepcopy(req.inputs)
tmp_inputs, tmp_tweaks = cls.parse_compare_inputs(tmp_inputs, question)
for version in version_infos:
task = asyncio.create_task(cls.exec_flow_node(
tmp_inputs, tmp_tweaks, question_index, [version]))
copy.deepcopy(tmp_inputs), tmp_tweaks, question_index, [version]))
tasks.append(task)
return tasks

Expand Down
7 changes: 4 additions & 3 deletions src/backend/bisheng/database/models/variable_value.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,10 @@ def copy_variables(cls, flow_id: str, old_version_id: int, version_id: int) -> L
query = select(Variable).where(Variable.flow_id == flow_id, Variable.version_id == old_version_id)
old_version = session.exec(query).all()
for one in old_version:
one.id = None
one.version_id = version_id
session.add(one)
new_version = Variable.from_orm(one)
new_version.id = None
new_version.version_id = version_id
session.add(new_version)
session.commit()
return old_version

2 changes: 1 addition & 1 deletion src/frontend/public/locales/zh/bs.json
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@
"addTool": "添加工具",
"search": "搜索",
"empty": "空空如也",
"onlineSA": "Go online skills&assistants",
"onlineSA": "上线技能&助手",
"params": "参数",
"added": "已添加",
"add": "添加",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function Component({ compId, options, disables, version, classNam

// 保留当前compId和上游组件
const nodes = useMemo(() => {
if (!version) return [];
if (!version?.data) return [];
const showNodes = {}
const edges = version.data.edges

Expand Down
4 changes: 2 additions & 2 deletions src/frontend/src/pages/DiffFlowPage/components/RunTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default function RunTest({ nodeId }) {
return cur ? count + 1 : count
}, 0) + 1 // +1 测试用例列

return 100 / (count + 1)
return 100 / (count === 2 ? 2 : count + 1) // hack 两个 按 45% 分
}, [mulitVersionFlow])

const handleUploadTxt = () => {
Expand Down Expand Up @@ -173,7 +173,7 @@ export default function RunTest({ nodeId }) {
</TableHead>
)
}
<TableHead className="text-right max-w-[135px]" style={{ width: '10%' }}>
<TableHead className="text-right min-w-[135px]" style={{ width: 135 }}>
<Button variant="link" disabled={runningType !== '' || !running} onClick={handleDownExcle}><DownloadIcon className="mr-1" />{t('test.downloadResults')}</Button>
</TableHead>
</TableRow>
Expand Down
1 change: 1 addition & 0 deletions src/frontend/src/pages/FlowPage/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export default function Header({ flow }) {
// 更新版本列表
await refrenshVersions()
// 切换到最新版本

setVersionId(res.id)
}
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import { Badge } from "@/components/bs-ui/badge";
import { LayersIcon } from "@radix-ui/react-icons";
import { Button } from "@/components/bs-ui/button";
import { updateVersion } from "@/controllers/API/flow";
import { captureAndAlertRequestErrorHoc } from "@/controllers/request";

const nodeTypes = {
genericNode: GenericNode,
Expand Down Expand Up @@ -308,7 +309,7 @@ export default function Page({ flow, preFlow }: { flow: FlowType, preFlow: strin

// 离开并保存
const handleSaveAndClose = async () => {
await updateVersion(version.id, { name: version.name, description: '', data: flow.data })
await captureAndAlertRequestErrorHoc(updateVersion(version.id, { name: version.name, description: '', data: flow.data }))
blocker.proceed?.()
}

Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/pages/FlowPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default function FlowPage() {
getFlowApi(id).then(_flow => setFlow('flow_init', _flow))
}

return () => setFlow('destroy', null)
// return () => setFlow('destroy', null)
}, [])

const [copyFlow, preFlow] = useMemo(() => {
Expand Down

0 comments on commit 3374e09

Please sign in to comment.