mirror of
https://github.com/wassname/Open-Assistant.git
synced 2026-06-27 16:10:30 +08:00
Devcontainer backend dev (#608)
add backend-dev devcontainer and extract openapi.json to docs/
This commit is contained in:
+1
-1
@@ -6,7 +6,7 @@
|
||||
"version": "latest"
|
||||
}
|
||||
},
|
||||
"postCreateCommand": "bash .devcontainer/frontend/post_create_command.sh",
|
||||
"postCreateCommand": "bash .devcontainer/backend-dev/post_create_command.sh",
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"extensions": ["GitHub.copilot"]
|
||||
@@ -0,0 +1,23 @@
|
||||
# ensure pre-commit is installed
|
||||
pre-commit install
|
||||
|
||||
# create python virtual environment
|
||||
python3 -m venv .venv
|
||||
|
||||
# install python dependencies in /backend
|
||||
cd backend
|
||||
pip install -r requirements.txt
|
||||
cd ..
|
||||
|
||||
# install code in editable mode in /oasst-shared
|
||||
cd oasst-shared
|
||||
pip install -e .
|
||||
cd ..
|
||||
|
||||
# docker compose up for backend-dev
|
||||
docker compose up backend-dev --build --attach-dependencies -d
|
||||
|
||||
# note: commented out for now, you probably want to manually run this part once in the devcontainer
|
||||
# run run-local.sh script
|
||||
# cd scripts/backend-development/
|
||||
# bash run-local.sh
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "Open-Assistant",
|
||||
"image": "mcr.microsoft.com/vscode/devcontainers/universal",
|
||||
"features": {
|
||||
"ghcr.io/devcontainers-contrib/features/pre-commit:2": {
|
||||
"version": "latest"
|
||||
}
|
||||
},
|
||||
"postCreateCommand": "bash .devcontainer/frontend-dev/post_create_command.sh",
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"extensions": ["GitHub.copilot"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,3 +44,18 @@ run `alembic revision --autogenerate -m "..."` ("..." is what you did) in the
|
||||
`/backend` directory. Then edit the newly created file. See
|
||||
[here](https://alembic.sqlalchemy.org/en/latest/tutorial.html) for more
|
||||
information.
|
||||
|
||||
## API Documentation
|
||||
|
||||
Once you have successfully started the backend server, you can access the
|
||||
default api docs at `localhost:8080/docs`. If you need to update the exported
|
||||
openapi.json in the docs/ folder you can run below command to `wget` them from
|
||||
the relevant local fastapi endpoint. This will enable anyone to just see API
|
||||
docs via something like
|
||||
[Swagger.io](https://editor.swagger.io/?url=https://raw.githubusercontent.com/LAION-AI/Open-Assistant/main/docs/docs/api/openapi.json)
|
||||
without having to actually set up and run a development backend.
|
||||
|
||||
```bash
|
||||
# save openapi.json to docs/docs/api
|
||||
wget localhost:8080/api/v1/openapi.json -O docs/docs/api/openapi.json
|
||||
```
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -62,7 +62,11 @@ const config = {
|
||||
position: "left",
|
||||
label: "Docs",
|
||||
},
|
||||
//{ to: "/blog", label: "Blog", position: "left" },
|
||||
{
|
||||
href: "https://editor.swagger.io/?url=https://raw.githubusercontent.com/LAION-AI/Open-Assistant/main/docs/docs/api/openapi.json",
|
||||
label: "API",
|
||||
position: "left",
|
||||
},
|
||||
{
|
||||
href: "https://github.com/LAION-AI/Open-Assistant",
|
||||
label: "GitHub",
|
||||
|
||||
Reference in New Issue
Block a user