Skip to content

Commit

Permalink
Hotfix/0.4.1.1 (#1068)
Browse files Browse the repository at this point in the history
  • Loading branch information
zgqgit authored Jan 7, 2025
2 parents 4db197e + a49dd9c commit 5e3f25e
Show file tree
Hide file tree
Showing 39 changed files with 223 additions and 306 deletions.
4 changes: 2 additions & 2 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ services:

backend:
container_name: bisheng-backend
image: dataelement/bisheng-backend:v0.4.1
image: dataelement/bisheng-backend:v0.4.1.1
ports:
- "7860:7860"
environment:
Expand Down Expand Up @@ -94,7 +94,7 @@ services:

frontend:
container_name: bisheng-frontend
image: dataelement/bisheng-frontend:v0.4.1
image: dataelement/bisheng-frontend:v0.4.1.1
ports:
- "3001:3001"
environment:
Expand Down
2 changes: 1 addition & 1 deletion src/backend/bisheng/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

try:
# 通过ci去自动修改
__version__ = '0.4.1'
__version__ = '0.4.1.1'
except metadata.PackageNotFoundError:
# Case where package metadata is not available.
__version__ = ''
Expand Down
10 changes: 10 additions & 0 deletions src/backend/bisheng/api/errcode/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ class VersionNameExistsError(BaseErrorCode):
Msg: str = '版本名已存在'


class FlowNameExistsError(BaseErrorCode):
Code: int = 10503
Msg: str = '技能名重复'


class NotFoundFlowError(BaseErrorCode):
Code: int = 10520
Msg: str = '技能不存在'
Expand Down Expand Up @@ -47,6 +52,11 @@ class WorkFlowNodeRunMaxTimesError(BaseErrorCode):
Msg: str = '节点执行超过最大次数'


class WorkflowNameExistsError(BaseErrorCode):
Code: int = 10529
Msg: str = '工作流名称重复'


class FlowTemplateNameError(BaseErrorCode):
Code: int = 10530
Msg: str = '模板名称已存在'
4 changes: 2 additions & 2 deletions src/backend/bisheng/api/v1/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ def get_app_chat_list(*,
res_obj = PageList(list=[
AppChatList(user_name=user_map.get(one['user_id'], one['user_id']),
flow_name=flow_map[one['flow_id']].name if flow_map.get(one['flow_id']) else one['flow_id'],
flow_type=FlowType.ASSISTANT.value if assistant_map.get(one['flow_id'], None) else flow_map.get(one['flow_id']).flow_type,
**one) for one in res
flow_type=FlowType.ASSISTANT.value if assistant_map.get(one['flow_id'], None) else FlowType.FLOW.value,
**one) for one in res if flow_map.get(one['flow_id'])
],
total=count)

Expand Down
14 changes: 8 additions & 6 deletions src/backend/bisheng/api/v1/flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@
from typing import Any
from uuid import UUID

from fastapi import APIRouter, Depends, HTTPException, Query, Request
from fastapi_jwt_auth import AuthJWT
from sqlmodel import select
from starlette.responses import StreamingResponse

from bisheng.api.errcode.base import UnAuthorizedError
from bisheng.api.errcode.flow import FlowOnlineEditError
from bisheng.api.errcode.flow import FlowOnlineEditError, FlowNameExistsError
from bisheng.api.services.flow import FlowService
from bisheng.api.services.user_service import UserPayload, get_login_user
from bisheng.api.utils import build_flow_no_yield, get_L2_param_from_flow, remove_api_keys
Expand All @@ -16,10 +21,7 @@
from bisheng.database.models.role_access import AccessType
from bisheng.settings import settings
from bisheng.utils.logger import logger
from fastapi import APIRouter, Depends, HTTPException, Query, Request
from fastapi_jwt_auth import AuthJWT
from sqlmodel import select
from starlette.responses import StreamingResponse


# build router
router = APIRouter(prefix='/flows', tags=['Flows'], dependencies=[Depends(get_login_user)])
Expand All @@ -33,7 +35,7 @@ def create_flow(*, request: Request, flow: FlowCreate, login_user: UserPayload =
if session.exec(
select(Flow).where(Flow.name == flow.name,
Flow.user_id == login_user.user_id)).first():
raise HTTPException(status_code=500, detail='技能名重复')
raise FlowNameExistsError.http_exception()
flow.user_id = login_user.user_id
db_flow = Flow.model_validate(flow)
# 创建新的技能
Expand Down
4 changes: 2 additions & 2 deletions src/backend/bisheng/api/v1/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from sqlmodel import select

from bisheng.api.errcode.base import UnAuthorizedError
from bisheng.api.errcode.flow import FlowOnlineEditError
from bisheng.api.errcode.flow import FlowOnlineEditError, WorkflowNameExistsError
from bisheng.api.services.flow import FlowService
from bisheng.api.services.user_service import UserPayload, get_login_user
from bisheng.api.services.workflow import WorkFlowService
Expand Down Expand Up @@ -106,7 +106,7 @@ def create_flow(*, request: Request, flow: FlowCreate, login_user: UserPayload =
if session.exec(
select(Flow).where(Flow.name == flow.name, Flow.flow_type == FlowType.WORKFLOW.value,
Flow.user_id == login_user.user_id)).first():
raise HTTPException(status_code=500, detail='工作流名重复')
raise WorkflowNameExistsError.http_exception()
flow.user_id = login_user.user_id
db_flow = Flow.model_validate(flow)
db_flow.create_time = None
Expand Down
2 changes: 1 addition & 1 deletion src/backend/bisheng/chat/clients/workflow_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ async def check_status(self, message: dict, is_init: bool = False) -> (bool, str
self.workflow.set_workflow_stop()
try:
await self.send_response('processing', 'close', '')
await self.websocket.close(code=status.WS_1008_POLICY_VIOLATION, reason='workflow is offline')
await self.websocket.close(code=status.WS_1008_POLICY_VIOLATION, reason='当前工作流未上线,无法直接对话')
except:
logger.warning('websocket is closed')
pass
Expand Down
11 changes: 7 additions & 4 deletions src/backend/bisheng/workflow/nodes/output/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ def __init__(self, *args, **kwargs):
self._output_type = self.node_params['output_result']['type']
self._output_result = self.node_params['output_result']['value']

# 用户处理的结果
self._handled_output_result = self._output_result

# user input msg
self._output_msg = self.node_params['output_msg']['msg']
self._output_files = self.node_params['output_msg']['files']
Expand All @@ -32,7 +35,7 @@ def __init__(self, *args, **kwargs):

def handle_input(self, user_input: dict) -> Any:
# 需要存入state,
self._output_result = user_input['output_result']
self._handled_output_result = user_input['output_result']
self.graph_state.set_variable(self.id, 'output_result', user_input['output_result'])

def get_input_schema(self) -> Any:
Expand All @@ -45,15 +48,15 @@ def get_input_schema(self) -> Any:
def route_node(self, state: dict) -> str | list[str]:
# 选择型交互需要根据用户的输入,来判断下个节点
if self._output_type == 'choose':
return self.get_next_node_id(self._output_result)
return self.get_next_node_id(self._handled_output_result)
return self._next_node_id

def _run(self, unique_id: str):
self._source_documents = []
self.parse_output_msg()
self.send_output_msg(unique_id)
res = {
'output_result': self._output_result
'output_result': self._handled_output_result
}
return res

Expand All @@ -68,7 +71,7 @@ def parse_log(self, unique_id: str, result: dict) -> Any:
if self._output_type == 'input':
ret.append({
"key": "output_result",
"value": self._output_result,
"value": self._handled_output_result,
"type": "key"
})
return ret
Expand Down
2 changes: 1 addition & 1 deletion src/backend/bisheng/workflow/nodes/rag/rag.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def init_es(self):
else:
file_ids = []
for one in self._knowledge_value:
file_metadata = self.graph_state.get_variable_by_str(one)
file_metadata = self.graph_state.get_variable_by_str(f'{one}_file_metadata')
file_ids.append(file_metadata['file_id'])
node_type = 'ElasticKeywordsSearch'
params = {
Expand Down
4 changes: 2 additions & 2 deletions src/backend/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "bisheng"
version = "0.4.1"
version = "0.4.1.1"
description = "A Python package with a built-in web application"
authors = ["Dataelement <hanfeng@dataelem.com>"]
maintainers = [
Expand All @@ -18,7 +18,7 @@ include = ["./bisheng/*", "bisheng/**/*"]
bisheng = "bisheng.__main__:main"

[tool.poetry.dependencies]
bisheng_langchain = "0.4.1"
bisheng_langchain = "0.4.1.1"
bisheng_pyautogen = "0.3.2"
langchain = "^0.2.16"
langchain_experimental = "*"
Expand Down
14 changes: 11 additions & 3 deletions src/frontend/public/locales/en/bs.json
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,10 @@
"selected": "Selected",
"pleaseSelectAnApp": "Please select an app",
"allLabels": "All labels",
"searchLabels": "Search labels"
"searchLabels": "Search labels",
"confirmed": "Confirmed",
"confirm": "Confirm",
"runNewWorkflow": "Run New Workflow"
},
"model": {
"modelManagement": "Model Management",
Expand Down Expand Up @@ -329,7 +332,9 @@
"libraryCollection": "Knowledge Base Collection",
"createUser": "Create User",
"details": "Details",
"confirmDeleteLibrary": "Confirm deletion of this Knowledge Base?"
"confirmDeleteLibrary": "Confirm deletion of this Knowledge Base?",
"copy": "Copy",
"copying": "Copying"
},
"evaluation": {
"id": "Task ID",
Expand Down Expand Up @@ -404,7 +409,8 @@
"isRequired": "is Required",
"fileRequired": "The current file is empty",
"selectComponent": "Select a component",
"varLength": "Length cannot exceed"
"varLength": "Length cannot exceed",
"requiredField": "{{label}} is a required field and cannot be empty."
},
"status": {
"1004": "This skill has been deleted",
Expand Down Expand Up @@ -836,9 +842,11 @@
"10500": "Skill version information not found",
"10501": "Current version in use cannot be deleted",
"10502": "Version name already exists",
"10503": "Skill name already exists",
"10520": "Skill does not exist",
"10521": "Skill is online, cannot edit",
"10525": "Workflow is online and cannot be edited",
"10529": "Workflow name already exists",
"10530": "Template name already exists",
"10900": "Knowledge base name already exists",
"10901": "Knowledge base must select an embedding model",
Expand Down
8 changes: 7 additions & 1 deletion src/frontend/public/locales/en/flow.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,5 +147,11 @@
"dbNameTooLong": "Database name cannot exceed 100 characters",
"dbUsernameRequired": "Database username cannot be empty",
"dbUsernameTooLong": "Database username cannot exceed 100 characters",
"dbPasswordRequired": "Database password cannot be empty"
"dbPasswordRequired": "Database password cannot be empty",
"variableInput": "Variable Input",
"leaveAndSave": "Leave and Save",
"onlineVersionMessage": "The current version is online and cannot be modified. You can save the changes as a new version.",
"unsavedChangesMessage": "You have unsaved changes. Are you sure you want to leave?",
"runNode": "Run this node",
"copy": "Copy"
}
14 changes: 11 additions & 3 deletions src/frontend/public/locales/zh/bs.json
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,10 @@
"selected": "已选",
"pleaseSelectAnApp": "请选择一个应用",
"allLabels": "全部标签",
"searchLabels": "搜索标签"
"searchLabels": "搜索标签",
"confirmed": "已确认",
"confirm": "确认",
"runNewWorkflow": "运行新工作流"
},
"model": {
"modelManagement": "模型管理",
Expand Down Expand Up @@ -326,7 +329,9 @@
"libraryCollection": "知识库集合",
"createUser": "创建用户",
"details": "详情",
"confirmDeleteLibrary": "确认删除该知识库?"
"confirmDeleteLibrary": "确认删除该知识库?",
"copy": "复制",
"copying": "复制中"
},
"evaluation": {
"id": "任务ID",
Expand Down Expand Up @@ -401,7 +406,8 @@
"isRequired": "是必填项",
"fileRequired": "当前文件为空",
"selectComponent": "选择一个组件",
"varLength": "长度不能超过"
"varLength": "长度不能超过",
"requiredField": "{{label}} 为必填项,不能为空。"
},
"status": {
"1004": "该技能已被删除",
Expand Down Expand Up @@ -833,9 +839,11 @@
"10500": "未找到技能版本信息",
"10501": "当前正在使用版本无法删除",
"10502": "版本名已存在",
"10503": "技能名称重复",
"10520": "技能不存在",
"10521": "技能已上线,不可编辑",
"10525": "工作流已上线,不可编辑",
"10529": "工作流名称重复",
"10530": "模板名称已存在",
"10900": "知识库名称不可重复",
"10901": "知识库必须选择一个embedding模型",
Expand Down
8 changes: 7 additions & 1 deletion src/frontend/public/locales/zh/flow.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,5 +147,11 @@
"dbNameTooLong": "数据库名称最多 100 字",
"dbUsernameRequired": "数据库用户名不可为空",
"dbUsernameTooLong": "数据库用户名最多 100 字",
"dbPasswordRequired": "数据库密码不可为空"
"dbPasswordRequired": "数据库密码不可为空",
"variableInput": "变量输入",
"leaveAndSave": "离开并保存",
"onlineVersionMessage": "当前版本已上线不可修改,可另存为新版本保存修改内容",
"unsavedChangesMessage": "您有未保存的更改,确定要离开吗?",
"runNode": "运行此节点",
"copy": "复制"
}
8 changes: 4 additions & 4 deletions src/frontend/src/components/bs-comp/sheets/AppTempSheet.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AbilitiesIcon, FlowIcon, HelperIcon } from "@/components/bs-icons/app";
import { readTempsDatabase } from "@/controllers/API";
import { AppType } from "@/types/app";
import { Bot } from "lucide-react";
import { useEffect, useMemo, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
import { SearchInput } from "../../bs-ui/input";
Expand Down Expand Up @@ -64,21 +64,21 @@ export default function AppTempSheet({ children, onCustomCreate, onSelect }) {
className={`flex items-center gap-2 px-4 py-2 rounded-md cursor-pointer hover:bg-muted-foreground/10 transition-all duration-200 mb-2 ${type === AppType.FLOW && 'bg-muted-foreground/10'}`}
onClick={() => setType(AppType.FLOW)}
>
{/* <Bot /> */}
<FlowIcon />
<span>{t('workflow')}</span>
</div>
<div
className={`flex items-center gap-2 px-4 py-2 rounded-md cursor-pointer hover:bg-muted-foreground/10 transition-all duration-200 mb-2 ${type === AppType.ASSISTANT && 'bg-muted-foreground/10'}`}
onClick={() => setType(AppType.ASSISTANT)}
>
{/* <Bot /> */}
<HelperIcon />
<span>{t('assistant')}</span>
</div>
<div
className={`flex items-center gap-2 px-4 py-2 rounded-md cursor-pointer hover:bg-muted-foreground/10 transition-all duration-200 mb-2 ${type === AppType.SKILL && 'bg-muted-foreground/10'}`}
onClick={() => setType(AppType.SKILL)}
>
{/* <Bot /> */}
<AbilitiesIcon />
<span>{t('skill')}</span>
</div>
</div>
Expand Down
13 changes: 13 additions & 0 deletions src/frontend/src/components/bs-icons/app/abilities.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions src/frontend/src/components/bs-icons/app/flow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions src/frontend/src/components/bs-icons/app/helper.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 5e3f25e

Please sign in to comment.