Skip to content

Commit

Permalink
Feat/0.1.9.3 (#139)
Browse files Browse the repository at this point in the history
解决setting初始化错误
  • Loading branch information
yaojin3616 authored Nov 10, 2023
2 parents 7cb2127 + fd4a55c commit 2f787c0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 128 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ concurrency:
cancel-in-progress: true

jobs:
build_bisheng_api:
build_bisheng_langchain:
strategy:
fail-fast: false
runs-on: ubuntu-latest
#if: startsWith(github.event.ref, 'refs/tags')
steps:
Expand Down Expand Up @@ -43,10 +45,14 @@ jobs:
pip install twine
cd ./src/bisheng-langchain
python setup.py bdist_wheel
set +e
twine upload dist/* -u ${{ secrets.PYPI_USER }} -p ${{ secrets.PYPI_PASSWORD }} --repository pypi
set -e
build_bisheng:
needs: build_bisheng_api
needs: build_bisheng_langchain
runs-on: ubuntu-latest
# if: startsWith(github.event.ref, 'refs/tags')
steps:
Expand Down
118 changes: 0 additions & 118 deletions .github/workflows/main.yml

This file was deleted.

4 changes: 2 additions & 2 deletions src/backend/bisheng/api/v2/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
chat_manager = ChatManager()
flow_data_store = redis_client
expire = 600 # reids 60s 过期
default_user_id = settings.get_from_db('default_operator')


@router.websocket('/ws/{flow_id}')
Expand Down Expand Up @@ -60,7 +59,8 @@ async def union_websocket(flow_id: str,
key_node = get_cache_key(flow_id, chat_id, node.id)
chat_manager.set_cache(key_node, node._built_object)
chat_manager.set_cache(get_cache_key(flow_id, chat_id), node._built_object)
await chat_manager.handle_websocket(flow_id, chat_id, websocket, default_user_id)
await chat_manager.handle_websocket(flow_id, chat_id, websocket,
settings.get_from_db('default_operator'))
except Exception as exc:
logger.error(exc)
await websocket.close(code=status.WS_1011_INTERNAL_ERROR, reason=str(exc))
12 changes: 6 additions & 6 deletions src/backend/bisheng/api/v2/filelib.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
# build router
router = APIRouter(prefix='/filelib')

default_user_id = settings.get_from_db('default_operator')


@router.post('/', response_model=KnowledgeRead, status_code=201)
def create_knowledge(
Expand All @@ -35,13 +33,14 @@ def create_knowledge(
db_knowldge = Knowledge.from_orm(knowledge)
know = session.exec(
select(Knowledge).where(Knowledge.name == knowledge.name,
knowledge.user_id == default_user_id)).all()
knowledge.user_id == settings.get_from_db('default_operator'))
).all()
if know:
raise HTTPException(status_code=500, detail='知识库名称重复')
if not db_knowldge.collection_name:
# 默认collectionName
db_knowldge.collection_name = f'col_{int(time.time())}_{str(uuid4())[:8]}'
db_knowldge.user_id = default_user_id
db_knowldge.user_id = settings.get_from_db('default_operator')
session.add(db_knowldge)
session.commit()
session.refresh(db_knowldge)
Expand All @@ -62,7 +61,8 @@ def update_knowledge(

know = session.exec(
select(Knowledge).where(Knowledge.name == knowledge.name,
knowledge.user_id == default_user_id)).all()
knowledge.user_id == settings.get_from_db('default_operator')
)).all()
if know:
raise HTTPException(status_code=500, detail='知识库名称重复')

Expand All @@ -81,7 +81,7 @@ def get_knowledge(
page_num: Optional[str],
):
""" 读取所有知识库信息. """

default_user_id = settings.get_from_db('default_operator')
try:
sql = select(Knowledge)
count_sql = select(func.count(Knowledge.id))
Expand Down

0 comments on commit 2f787c0

Please sign in to comment.