Spaces:
Runtime error
Runtime error
Commit ·
40a9b82
0
Parent(s):
feat: :tada: init commit
Browse files- .dockerignore +8 -0
- .flake8 +5 -0
- .github/workflows/flake8.yml +23 -0
- .github/workflows/test.yml +54 -0
- .gitignore +141 -0
- LICENSE +21 -0
- README.md +5 -0
- edu_assistant/server.py +0 -0
- edu_assistant/version.py +4 -0
- poetry.lock +0 -0
- pyproject.toml +54 -0
.dockerignore
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
example/
|
| 2 |
+
test/
|
| 3 |
+
tmp/
|
| 4 |
+
|
| 5 |
+
.github/
|
| 6 |
+
.dockerignore
|
| 7 |
+
Dockerfile
|
| 8 |
+
poetry.lock
|
.flake8
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[flake8]
|
| 2 |
+
max-line-length = 120
|
| 3 |
+
exclude=
|
| 4 |
+
.venv
|
| 5 |
+
__pycache__
|
.github/workflows/flake8.yml
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Checkstyle
|
| 2 |
+
|
| 3 |
+
on: [push]
|
| 4 |
+
|
| 5 |
+
jobs:
|
| 6 |
+
build:
|
| 7 |
+
runs-on: ubuntu-latest
|
| 8 |
+
|
| 9 |
+
steps:
|
| 10 |
+
-
|
| 11 |
+
name: Checkout
|
| 12 |
+
uses: actions/checkout@v3
|
| 13 |
+
- name: Set up Python
|
| 14 |
+
uses: actions/setup-python@v4
|
| 15 |
+
with:
|
| 16 |
+
python-version: '3.10'
|
| 17 |
+
- name: Install dependencies
|
| 18 |
+
run: |
|
| 19 |
+
python -m pip install --upgrade pip
|
| 20 |
+
pip install flake8
|
| 21 |
+
- name: Analysing the code with flake8
|
| 22 |
+
run: |
|
| 23 |
+
flake8 .
|
.github/workflows/test.yml
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: PyTest
|
| 2 |
+
on:
|
| 3 |
+
pull_request:
|
| 4 |
+
branches:
|
| 5 |
+
- master
|
| 6 |
+
push:
|
| 7 |
+
branches:
|
| 8 |
+
- master
|
| 9 |
+
|
| 10 |
+
permissions:
|
| 11 |
+
contents: write
|
| 12 |
+
pull-requests: write
|
| 13 |
+
|
| 14 |
+
jobs:
|
| 15 |
+
test:
|
| 16 |
+
runs-on: ubuntu-latest
|
| 17 |
+
|
| 18 |
+
steps:
|
| 19 |
+
- uses: actions/checkout@v1
|
| 20 |
+
with:
|
| 21 |
+
fetch-depth: 1
|
| 22 |
+
|
| 23 |
+
- name: "Setup Python, Poetry and Dependencies"
|
| 24 |
+
uses: packetcoders/action-setup-cache-python-poetry@main
|
| 25 |
+
with:
|
| 26 |
+
python-version: '3.10'
|
| 27 |
+
poetry-version: '1.5.1'
|
| 28 |
+
|
| 29 |
+
- name: Install Dependencies
|
| 30 |
+
run: poetry install
|
| 31 |
+
|
| 32 |
+
- name: Run Test
|
| 33 |
+
run:
|
| 34 |
+
poetry run pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=codedog test/ | tee pytest-coverage.txt
|
| 35 |
+
|
| 36 |
+
- name: Pytest coverage comment
|
| 37 |
+
id: coverageComment
|
| 38 |
+
uses: MishaKav/pytest-coverage-comment@main
|
| 39 |
+
with:
|
| 40 |
+
pytest-coverage-path: ./pytest-coverage.txt
|
| 41 |
+
junitxml-path: ./pytest.xml
|
| 42 |
+
default-branch: master
|
| 43 |
+
|
| 44 |
+
- name: Create Badge
|
| 45 |
+
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
|
| 46 |
+
uses: schneegans/dynamic-badges-action@v1.6.0
|
| 47 |
+
with:
|
| 48 |
+
auth: ${{ secrets.GH_TOKEN }}
|
| 49 |
+
gistID: ce38dae58995aeffef42065093fcfe84
|
| 50 |
+
filename: edu_assistant_master.json
|
| 51 |
+
label: Coverage
|
| 52 |
+
message: ${{ steps.coverageComment.outputs.coverage }}
|
| 53 |
+
color: ${{ steps.coverageComment.outputs.color }}
|
| 54 |
+
namedLogo: python
|
.gitignore
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Byte-compiled / optimized / DLL files
|
| 2 |
+
__pycache__/
|
| 3 |
+
*.py[cod]
|
| 4 |
+
*$py.class
|
| 5 |
+
|
| 6 |
+
# C extensions
|
| 7 |
+
*.so
|
| 8 |
+
|
| 9 |
+
# Distribution / packaging
|
| 10 |
+
.Python
|
| 11 |
+
build/
|
| 12 |
+
develop-eggs/
|
| 13 |
+
dist/
|
| 14 |
+
downloads/
|
| 15 |
+
eggs/
|
| 16 |
+
.eggs/
|
| 17 |
+
lib/
|
| 18 |
+
lib64/
|
| 19 |
+
parts/
|
| 20 |
+
sdist/
|
| 21 |
+
var/
|
| 22 |
+
wheels/
|
| 23 |
+
pip-wheel-metadata/
|
| 24 |
+
share/python-wheels/
|
| 25 |
+
*.egg-info/
|
| 26 |
+
.installed.cfg
|
| 27 |
+
*.egg
|
| 28 |
+
MANIFEST
|
| 29 |
+
|
| 30 |
+
# .vscode files
|
| 31 |
+
.vscode/
|
| 32 |
+
|
| 33 |
+
# Pycharm
|
| 34 |
+
.idea/
|
| 35 |
+
|
| 36 |
+
# PyInstaller
|
| 37 |
+
# Usually these files are written by a python script from a template
|
| 38 |
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
| 39 |
+
*.manifest
|
| 40 |
+
*.spec
|
| 41 |
+
|
| 42 |
+
# Installer logs
|
| 43 |
+
pip-log.txt
|
| 44 |
+
pip-delete-this-directory.txt
|
| 45 |
+
|
| 46 |
+
# Unit test / coverage rerts
|
| 47 |
+
htmlcov/
|
| 48 |
+
.tox/
|
| 49 |
+
.nox/
|
| 50 |
+
.coverage
|
| 51 |
+
.coverage.*
|
| 52 |
+
.cache
|
| 53 |
+
nosetests.xml
|
| 54 |
+
coverage.xml
|
| 55 |
+
*.cover
|
| 56 |
+
*.py,cover
|
| 57 |
+
.hypothesis/
|
| 58 |
+
.pytest_cache/
|
| 59 |
+
|
| 60 |
+
# Translations
|
| 61 |
+
*.mo
|
| 62 |
+
*.pot
|
| 63 |
+
|
| 64 |
+
# Django stuff:
|
| 65 |
+
*.log
|
| 66 |
+
local_settings.py
|
| 67 |
+
db.sqlite3
|
| 68 |
+
db.sqlite3-journal
|
| 69 |
+
|
| 70 |
+
# Flask stuff:
|
| 71 |
+
instance/
|
| 72 |
+
.webassets-cache
|
| 73 |
+
|
| 74 |
+
# Scrapy stuff:
|
| 75 |
+
.scrapy
|
| 76 |
+
|
| 77 |
+
# Sphinx documentation
|
| 78 |
+
docs/_build/
|
| 79 |
+
|
| 80 |
+
# PyBuilder
|
| 81 |
+
target/
|
| 82 |
+
|
| 83 |
+
# Jupyter Notebook
|
| 84 |
+
.ipynb_checkpoints
|
| 85 |
+
|
| 86 |
+
# IPython
|
| 87 |
+
profile_default/
|
| 88 |
+
ipython_config.py
|
| 89 |
+
|
| 90 |
+
# pyenv
|
| 91 |
+
.python-version
|
| 92 |
+
|
| 93 |
+
# pipenv
|
| 94 |
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
| 95 |
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
| 96 |
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
| 97 |
+
# install all needed dependencies.
|
| 98 |
+
#Pipfile.lock
|
| 99 |
+
|
| 100 |
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
| 101 |
+
__pypackages__/
|
| 102 |
+
|
| 103 |
+
# Celery stuff
|
| 104 |
+
celerybeat-schedule
|
| 105 |
+
celerybeat.pid
|
| 106 |
+
|
| 107 |
+
# SageMath parsed files
|
| 108 |
+
*.sage.py
|
| 109 |
+
|
| 110 |
+
# Environments
|
| 111 |
+
.env
|
| 112 |
+
.env.bat
|
| 113 |
+
.venv
|
| 114 |
+
env/
|
| 115 |
+
venv/
|
| 116 |
+
ENV/
|
| 117 |
+
env.bak/
|
| 118 |
+
venv.bak/
|
| 119 |
+
myvenv/
|
| 120 |
+
tmp/
|
| 121 |
+
|
| 122 |
+
# Spyder project settings
|
| 123 |
+
.spyderproject
|
| 124 |
+
.spyproject
|
| 125 |
+
|
| 126 |
+
# Rope project settings
|
| 127 |
+
.ropeproject
|
| 128 |
+
|
| 129 |
+
# mkdocs documentation
|
| 130 |
+
/site
|
| 131 |
+
|
| 132 |
+
# mypy
|
| 133 |
+
.mypy_cache/
|
| 134 |
+
.dmypy.json
|
| 135 |
+
dmypy.json
|
| 136 |
+
|
| 137 |
+
# Pyre type checker
|
| 138 |
+
.pyre/
|
| 139 |
+
|
| 140 |
+
# macOS .DS_Store files
|
| 141 |
+
.DS_Store
|
LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
MIT License
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2023 Codedog Team
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE.
|
README.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Edu Assistant
|
| 2 |
+
|
| 3 |
+
[](https://github.com/codedog-ai/edu-assistant/actions/workflows/flake8.yml)
|
| 4 |
+
[](https://github.com/codedog-ai/edu-assistant/actions/workflows/test.yml)
|
| 5 |
+
[](https://github.com/codedog-ai/edu-assistant/actions/workflows/test.yml)
|
edu_assistant/server.py
ADDED
|
File without changes
|
edu_assistant/version.py
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -- Project information -----------------------------------------------------
|
| 2 |
+
|
| 3 |
+
PROJECT = "edu-assistant"
|
| 4 |
+
VERSION = "0.0.0"
|
poetry.lock
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
pyproject.toml
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[tool.poetry]
|
| 2 |
+
name = "edu-assistant"
|
| 3 |
+
version = "0.1.0"
|
| 4 |
+
description = ""
|
| 5 |
+
authors = ["codedog-ai"]
|
| 6 |
+
license = "MIT"
|
| 7 |
+
readme = "README.md"
|
| 8 |
+
packages = [{include = "edu_assistant"}]
|
| 9 |
+
|
| 10 |
+
[tool.poetry.dependencies]
|
| 11 |
+
python = "^3.10"
|
| 12 |
+
fastapi = "^0.95.1"
|
| 13 |
+
langchain = "^0.0.179"
|
| 14 |
+
openai = "^0.27.4"
|
| 15 |
+
pydantic = "^1.10.7"
|
| 16 |
+
tenacity = "^8.2.2"
|
| 17 |
+
uvicorn = "^0.21.1"
|
| 18 |
+
|
| 19 |
+
[tool.poetry.group.dev]
|
| 20 |
+
optional = true
|
| 21 |
+
|
| 22 |
+
[tool.poetry.group.dev.dependencies]
|
| 23 |
+
black = "^23.3.0"
|
| 24 |
+
flake8 = "^6.0.0"
|
| 25 |
+
isort = "^5.12.0"
|
| 26 |
+
pytest = "^7.2.1"
|
| 27 |
+
pytest-asyncio = "^0.20.3"
|
| 28 |
+
pytest-cov = "^4.0.0"
|
| 29 |
+
python-semantic-release = "^7.34.6"
|
| 30 |
+
|
| 31 |
+
[tool.poetry.scripts]
|
| 32 |
+
start = "edu_assistant.server:start"
|
| 33 |
+
|
| 34 |
+
[[tool.poetry.source]]
|
| 35 |
+
name = "aliyun"
|
| 36 |
+
url = "http://mirrors.aliyun.com/pypi/simple"
|
| 37 |
+
priority = "primary"
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
[[tool.poetry.source]]
|
| 41 |
+
name = "PyPI"
|
| 42 |
+
priority = "primary"
|
| 43 |
+
|
| 44 |
+
[tool.semantic_release]
|
| 45 |
+
version_variable = "./edu_assistant/version.py:VERSION"
|
| 46 |
+
build_command = false
|
| 47 |
+
upload_to_pypi = false
|
| 48 |
+
upload_to_repository = false
|
| 49 |
+
upload_to_release = false
|
| 50 |
+
commit_message = 'chore(release): release version {version}'
|
| 51 |
+
|
| 52 |
+
[build-system]
|
| 53 |
+
requires = ["poetry-core"]
|
| 54 |
+
build-backend = "poetry.core.masonry.api"
|