mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
Merge branch 'main' of github.com:maxkb-dev/maxkb
This commit is contained in:
commit
321cb29712
|
|
@ -0,0 +1,53 @@
|
|||
name: build-and-push
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
registryAddress:
|
||||
description: 'Registry Address'
|
||||
default: 'registry-hkproxy.fit2cloud.com'
|
||||
required: true
|
||||
dockerImageName:
|
||||
description: 'Docker Image Name'
|
||||
default: 'maxkb/maxkb'
|
||||
required: true
|
||||
dockerImageTag:
|
||||
description: 'Docker Image Tag'
|
||||
default: 'v1.0.0'
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Prepare
|
||||
id: prepare
|
||||
run: |
|
||||
DOCKER_IMAGE=${{ github.event.inputs.registryAddress }}/${{ github.event.inputs.dockerImageName }}
|
||||
DOCKER_PLATFORMS=linux/amd64,linux/arm64
|
||||
TAG_NAME=${{ github.event.inputs.dockerImageTag }}
|
||||
DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME} --tag ${DOCKER_IMAGE}:latest"
|
||||
echo ::set-output name=docker_image::${DOCKER_IMAGE}
|
||||
echo ::set-output name=version::${TAG_NAME}
|
||||
echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \
|
||||
--build-arg VERSION=${TAG_NAME} \
|
||||
--build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
|
||||
--build-arg --no-cache \
|
||||
--build-arg VCS_REF=${GITHUB_SHA::8} \
|
||||
${DOCKER_IMAGE_TAGS} .
|
||||
- name: Set up Docker Buildx
|
||||
uses: crazy-max/ghaction-docker-buildx@v3
|
||||
- name: Docker Buildx (build)
|
||||
run: |
|
||||
docker buildx build --output "type=image,push=false" ${{ steps.prepare.outputs.buildx_args }}
|
||||
- name: Login to Registry
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ${{ github.event.inputs.registryAddress }}
|
||||
username: ${{ secrets.FIT2CLOUD_REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.FIT2CLOUD_REGISTRY_PASSWORD }}
|
||||
- name: Docker Buildx (push)
|
||||
run: |
|
||||
docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }}
|
||||
18
Dockerfile
18
Dockerfile
|
|
@ -1,3 +1,16 @@
|
|||
FROM python:3.11-slim as vector-model-build
|
||||
COPY install_model.py install_model.py
|
||||
RUN pip3 install --upgrade pip setuptools && \
|
||||
pip install pycrawlers && \
|
||||
pip install transformers && \
|
||||
python3 install_model.py
|
||||
|
||||
FROM node:18-alpine3.18 as web-build
|
||||
COPY ui ui
|
||||
RUN cd ui && \
|
||||
npm install && \
|
||||
npm run build
|
||||
|
||||
FROM python:3.11-slim
|
||||
|
||||
ENV LANG=C.UTF-8
|
||||
|
|
@ -6,7 +19,10 @@ USER root
|
|||
# 创建工作目录
|
||||
RUN mkdir -p /opt/maxkb/app && mkdir -p /opt/maxkb/model
|
||||
# 拷贝项目
|
||||
RUN ls -la
|
||||
COPY . /opt/maxkb/app
|
||||
COPY --from=vector-model-build model /opt/maxkb/app/model
|
||||
COPY --from=web-build ui /opt/maxkb/app/ui
|
||||
# 复制模型
|
||||
RUN mv /opt/maxkb/app/model/* /opt/maxkb/model
|
||||
RUN ls /opt/maxkb/model
|
||||
|
|
@ -22,7 +38,7 @@ RUN pip3 install poetry
|
|||
# 导出依赖
|
||||
RUN poetry export -f requirements.txt --output requirements.txt --without-hashes
|
||||
# 下载python依赖
|
||||
RUN pip3 install --no-cache-dir -r requirements.txt --trusted-host pypi.tuna.tsinghua.edu.cn
|
||||
RUN pip3 install --no-cache-dir -r requirements.txt
|
||||
# 删除前端依赖
|
||||
RUN rm -rf ui/node_modules
|
||||
# 启动命令
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"axios": "^0.27.2",
|
||||
"element-plus": "^2.4.3",
|
||||
"element-plus": "^2.5.3",
|
||||
"install": "^0.13.0",
|
||||
"lodash": "^4.17.21",
|
||||
"markdown-it": "^13.0.2",
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@ const prologueList = computed(() => {
|
|||
const temp = props.data?.prologue
|
||||
let arr: any = []
|
||||
const lines = temp?.split('\n')
|
||||
lines.forEach((str: string, index: number) => {
|
||||
lines?.forEach((str: string, index: number) => {
|
||||
if (isMdArray(str)) {
|
||||
arr[index] = {
|
||||
type: 'question',
|
||||
|
|
@ -292,7 +292,8 @@ function getChartOpenId() {
|
|||
chatMessage()
|
||||
})
|
||||
.catch((res) => {
|
||||
if (res.response.status === 401) {
|
||||
console.log(res)
|
||||
if (res.response.status === 403) {
|
||||
application.asyncAppAuthentication(accessToken).then(() => {
|
||||
getChartOpenId()
|
||||
})
|
||||
|
|
@ -405,26 +406,33 @@ function chatMessage() {
|
|||
record_id: '',
|
||||
vote_status: '-1'
|
||||
})
|
||||
chatList.value.push(chat)
|
||||
inputValue.value = ''
|
||||
nextTick(() => {
|
||||
// 将滚动条滚动到最下面
|
||||
scrollDiv.value.setScrollTop(Number.MAX_SAFE_INTEGER)
|
||||
})
|
||||
// 对话
|
||||
applicationApi
|
||||
.postChatMessage(chartOpenId.value, problem_text)
|
||||
.then((response) => {
|
||||
ChatManagement.addChatRecord(chat, 50, loading)
|
||||
ChatManagement.write(chat.id)
|
||||
const reader = response.body.getReader()
|
||||
// 处理流数据
|
||||
const write = getWrite(
|
||||
chat,
|
||||
reader,
|
||||
response.headers.get('Content-Type') !== 'application/json'
|
||||
)
|
||||
return reader.read().then(write)
|
||||
console.log(response.status)
|
||||
if (response.status === 401) {
|
||||
application.asyncAppAuthentication(accessToken).then(() => {
|
||||
chatMessage()
|
||||
})
|
||||
} else {
|
||||
chatList.value.push(chat)
|
||||
inputValue.value = ''
|
||||
nextTick(() => {
|
||||
// 将滚动条滚动到最下面
|
||||
scrollDiv.value.setScrollTop(Number.MAX_SAFE_INTEGER)
|
||||
})
|
||||
ChatManagement.addChatRecord(chat, 50, loading)
|
||||
ChatManagement.write(chat.id)
|
||||
const reader = response.body.getReader()
|
||||
// 处理流数据
|
||||
const write = getWrite(
|
||||
chat,
|
||||
reader,
|
||||
response.headers.get('Content-Type') !== 'application/json'
|
||||
)
|
||||
return reader.read().then(write)
|
||||
}
|
||||
})
|
||||
.then(() => {
|
||||
return !props.appId && getSourceDetail(chat)
|
||||
|
|
|
|||
|
|
@ -2,15 +2,8 @@
|
|||
<div class="login-warp flex-center">
|
||||
<div class="login-container w-full h-full">
|
||||
<el-row class="container w-full h-full">
|
||||
<el-col
|
||||
:xs="0"
|
||||
:sm="0"
|
||||
:md="10"
|
||||
:lg="10"
|
||||
:xl="10"
|
||||
class="left-container"
|
||||
v-if="screenWidth && screenWidth >= 990"
|
||||
>
|
||||
<!-- v-if="screenWidth && screenWidth >= 990" -->
|
||||
<el-col :xs="0" :sm="0" :md="10" :lg="10" :xl="10" class="left-container">
|
||||
<div class="login-image"></div>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="24" :md="14" :lg="14" :xl="14" class="right-container flex-center">
|
||||
|
|
@ -21,18 +14,18 @@
|
|||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue'
|
||||
import type { Ref } from 'vue'
|
||||
// import { ref, onMounted } from 'vue'
|
||||
// import type { Ref } from 'vue'
|
||||
defineOptions({ name: 'LoginLayout' })
|
||||
const screenWidth: Ref<number | null> = ref(null)
|
||||
onMounted(() => {
|
||||
screenWidth.value = document.body.clientWidth
|
||||
window.onresize = () => {
|
||||
return (() => {
|
||||
screenWidth.value = document.body.clientWidth
|
||||
})()
|
||||
}
|
||||
})
|
||||
// const screenWidth: Ref<number | null> = ref(null)
|
||||
// onMounted(() => {
|
||||
// screenWidth.value = document.body.clientWidth
|
||||
// window.onresize = () => {
|
||||
// return (() => {
|
||||
// screenWidth.value = document.body.clientWidth
|
||||
// })()
|
||||
// }
|
||||
// })
|
||||
</script>
|
||||
<style lang="scss" scope>
|
||||
.login-warp {
|
||||
|
|
|
|||
Loading…
Reference in New Issue