Skip to content

Commit

Permalink
Hotfix/qa (#953)
Browse files Browse the repository at this point in the history
修复QA更新bug
  • Loading branch information
yaojin3616 authored Nov 12, 2024
2 parents 57410a2 + 9f65100 commit 64ef893
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
15 changes: 10 additions & 5 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行
REPO:
from_secret: PY_NEXUS
commands: # 定义在Docker容器中执行的shell命令
- pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
- pip install Cython
- pip install wheel
- pip install twine
- pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
- cd ./src/bisheng-langchain
- python setup.py bdist_wheel
- twine upload --verbose -u $NEXUS_USER -p $NEXUS_PASSWORD --repository-url $REPO dist/*.whl
Expand Down Expand Up @@ -64,9 +64,9 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行
- REPO2=$(echo $REPO | sed 's/http:\\/\\///g')
- sed '/apt-get/ s|$| '"$PROXY"'|' Dockerfile
- sed -i 's/^bisheng_langchain.*/bisheng_langchain = "'$RELEASE_VERSION'"/g' pyproject.toml
- sed -i '6i\RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple' Dockerfile
- sed -i '23i\RUN poetry source add --priority=supplemental foo http://'$NEXUS_PUBLIC':'$NEXUS_PUBLIC_PASSWORD'@'$REPO2'simple' Dockerfile
- sed -i '23i\RUN poetry source add --priority=primary qh https://pypi.tuna.tsinghua.edu.cn/simple' Dockerfile
- sed -i '16i\RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple' Dockerfile
- sed -i '38i\RUN poetry source add --priority=supplemental foo http://'$NEXUS_PUBLIC':'$NEXUS_PUBLIC_PASSWORD'@'$REPO2'simple' Dockerfile
- sed -i '38i\RUN poetry source add --priority=primary qh https://pypi.tuna.tsinghua.edu.cn/simple' Dockerfile
- cat Dockerfile

- name: build_docker
Expand All @@ -78,6 +78,8 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行
path: /var/cache/apt/archives # 将应用打包好的Jar和执行脚本挂载出来
- name: socket
path: /var/run/docker.sock
- name: pro-cache
path: /root/.local/share/pypoetry
environment:
http_proxy:
from_secret: PROXY
Expand Down Expand Up @@ -182,9 +184,12 @@ volumes:
- name: bisheng-cache
host:
path: /opt/drone/data/bisheng/
- name: pro-cache
host:
path: /opt/drone/data/pro/
- name: apt-cache
host:
path: /opt/drone/data/bisheng/apt/
- name: socket
host:
path: /var/run/docker.sock
path: /var/run/docker.sock
14 changes: 13 additions & 1 deletion src/backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@ FROM python:3.10-slim

WORKDIR /app

RUN echo \
deb https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib \
deb-src https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib \
deb https://mirrors.aliyun.com/debian-security/ bookworm-security main \
deb-src https://mirrors.aliyun.com/debian-security/ bookworm-security main \
deb https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib \
deb-src https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib \
deb https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib \
deb-src https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib \
> /etc/apt/sources.list


# Install Poetry
RUN apt-get update && apt-get install gcc g++ curl build-essential postgresql-server-dev-all -y
RUN apt-get update && apt-get install procps -y
Expand All @@ -21,7 +33,7 @@ COPY ./ ./
RUN mv -f ./nltk_data /root/nltk_data/

RUN python -m pip install --upgrade pip && \
pip install shapely==2.0.1
pip install shapely==2.0.1

# Install dependencies
RUN poetry config virtualenvs.create false
Expand Down
2 changes: 1 addition & 1 deletion src/backend/bisheng/api/v1/knowledge.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ async def qa_add(*, QACreate: QAKnowledgeUpsert, login_user: UserPayload = Depen
raise HTTPException(status_code=404, detail='知识库类型错误')

db_q = QAKnoweldgeDao.get_qa_knowledge_by_name(QACreate.questions, QACreate.knowledge_id)
if db_q:
if db_q and not QACreate.id:
raise KnowledgeQAError.http_exception()

add_qa(db_knowledge=db_knowledge, data=QACreate)
Expand Down

0 comments on commit 64ef893

Please sign in to comment.