Upload 33 files
Browse files- .devcontainer/Dockerfile +5 -0
- .devcontainer/README.md +37 -0
- .devcontainer/devcontainer.json +52 -0
- .devcontainer/noop.txt +3 -0
- .devcontainer/post_create_command.sh +12 -0
- .devcontainer/post_start_command.sh +3 -0
- .devcontainer/troubleshooting.png +0 -0
- .github/CODE_OF_CONDUCT.md +43 -0
- .github/DISCUSSION_TEMPLATE/general.yml +24 -0
- .github/DISCUSSION_TEMPLATE/help.yml +30 -0
- .github/DISCUSSION_TEMPLATE/suggestion.yml +37 -0
- .github/ISSUE_TEMPLATE/bug_report.yml +61 -0
- .github/ISSUE_TEMPLATE/config.yml +5 -0
- .github/ISSUE_TEMPLATE/document_issue.yml +24 -0
- .github/ISSUE_TEMPLATE/feature_request.yml +40 -0
- .github/ISSUE_TEMPLATE/translation_issue.yml +55 -0
- .github/actions/setup-poetry/action.yml +36 -0
- .github/linters/.hadolint.yaml +1 -0
- .github/linters/.isort.cfg +2 -0
- .github/linters/.yaml-lint.yml +11 -0
- .github/pull_request_template.md +25 -0
- .github/workflows/api-tests.yml +84 -0
- .github/workflows/build-push.yml +148 -0
- .github/workflows/db-migration-test.yml +58 -0
- .github/workflows/deploy-dev.yml +24 -0
- .github/workflows/docker-build.yml +47 -0
- .github/workflows/expose_service_ports.sh +14 -0
- .github/workflows/stale.yml +30 -0
- .github/workflows/style.yml +159 -0
- .github/workflows/tool-test-sdks.yaml +44 -0
- .github/workflows/translate-i18n-base-on-english.yml +55 -0
- .github/workflows/vdb-tests.yml +76 -0
- .github/workflows/web-tests.yml +49 -0
.devcontainer/Dockerfile
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM mcr.microsoft.com/devcontainers/python:3.12
|
2 |
+
|
3 |
+
# [Optional] Uncomment this section to install additional OS packages.
|
4 |
+
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
5 |
+
# && apt-get -y install --no-install-recommends <your-package-list-here>
|
.devcontainer/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Development with devcontainer
|
2 |
+
This project includes a devcontainer configuration that allows you to open the project in a container with a fully configured development environment.
|
3 |
+
Both frontend and backend environments are initialized when the container is started.
|
4 |
+
## GitHub Codespaces
|
5 |
+
[](https://codespaces.new/langgenius/dify)
|
6 |
+
|
7 |
+
you can simply click the button above to open this project in GitHub Codespaces.
|
8 |
+
|
9 |
+
For more info, check out the [GitHub documentation](https://docs.github.com/en/free-pro-team@latest/github/developing-online-with-codespaces/creating-a-codespace#creating-a-codespace).
|
10 |
+
|
11 |
+
|
12 |
+
## VS Code Dev Containers
|
13 |
+
[](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/langgenius/dify)
|
14 |
+
|
15 |
+
if you have VS Code installed, you can click the button above to open this project in VS Code Dev Containers.
|
16 |
+
|
17 |
+
You can learn more in the [Dev Containers documentation](https://code.visualstudio.com/docs/devcontainers/containers).
|
18 |
+
|
19 |
+
|
20 |
+
## Pros of Devcontainer
|
21 |
+
Unified Development Environment: By using devcontainers, you can ensure that all developers are developing in the same environment, reducing the occurrence of "it works on my machine" type of issues.
|
22 |
+
|
23 |
+
Quick Start: New developers can set up their development environment in a few simple steps, without spending a lot of time on environment configuration.
|
24 |
+
|
25 |
+
Isolation: Devcontainers isolate your project from your host operating system, reducing the chance of OS updates or other application installations impacting the development environment.
|
26 |
+
|
27 |
+
## Cons of Devcontainer
|
28 |
+
Learning Curve: For developers unfamiliar with Docker and VS Code, using devcontainers may be somewhat complex.
|
29 |
+
|
30 |
+
Performance Impact: While usually minimal, programs running inside a devcontainer may be slightly slower than those running directly on the host.
|
31 |
+
|
32 |
+
## Troubleshooting
|
33 |
+
if you see such error message when you open this project in codespaces:
|
34 |
+

|
35 |
+
|
36 |
+
a simple workaround is change `/signin` endpoint into another one, then login with GitHub account and close the tab, then change it back to `/signin` endpoint. Then all things will be fine.
|
37 |
+
The reason is `signin` endpoint is not allowed in codespaces, details can be found [here](https://github.com/orgs/community/discussions/5204)
|
.devcontainer/devcontainer.json
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
2 |
+
// README at: https://github.com/devcontainers/templates/tree/main/src/anaconda
|
3 |
+
{
|
4 |
+
"name": "Python 3.12",
|
5 |
+
"build": {
|
6 |
+
"context": "..",
|
7 |
+
"dockerfile": "Dockerfile"
|
8 |
+
},
|
9 |
+
"features": {
|
10 |
+
"ghcr.io/devcontainers/features/node:1": {
|
11 |
+
"nodeGypDependencies": true,
|
12 |
+
"version": "lts"
|
13 |
+
},
|
14 |
+
"ghcr.io/devcontainers-contrib/features/npm-package:1": {
|
15 |
+
"package": "typescript",
|
16 |
+
"version": "latest"
|
17 |
+
},
|
18 |
+
"ghcr.io/devcontainers/features/docker-in-docker:2": {
|
19 |
+
"moby": true,
|
20 |
+
"azureDnsAutoDetection": true,
|
21 |
+
"installDockerBuildx": true,
|
22 |
+
"version": "latest",
|
23 |
+
"dockerDashComposeVersion": "v2"
|
24 |
+
}
|
25 |
+
},
|
26 |
+
"customizations": {
|
27 |
+
"vscode": {
|
28 |
+
"extensions": [
|
29 |
+
"ms-python.pylint",
|
30 |
+
"GitHub.copilot",
|
31 |
+
"ms-python.python"
|
32 |
+
]
|
33 |
+
}
|
34 |
+
},
|
35 |
+
"postStartCommand": "./.devcontainer/post_start_command.sh",
|
36 |
+
"postCreateCommand": "./.devcontainer/post_create_command.sh"
|
37 |
+
|
38 |
+
// Features to add to the dev container. More info: https://containers.dev/features.
|
39 |
+
// "features": {},
|
40 |
+
|
41 |
+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
42 |
+
// "forwardPorts": [],
|
43 |
+
|
44 |
+
// Use 'postCreateCommand' to run commands after the container is created.
|
45 |
+
// "postCreateCommand": "python --version",
|
46 |
+
|
47 |
+
// Configure tool-specific properties.
|
48 |
+
// "customizations": {},
|
49 |
+
|
50 |
+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
51 |
+
// "remoteUser": "root"
|
52 |
+
}
|
.devcontainer/noop.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
This file copied into the container along with environment.yml* from the parent
|
2 |
+
folder. This file is included to prevents the Dockerfile COPY instruction from
|
3 |
+
failing if no environment.yml is found.
|
.devcontainer/post_create_command.sh
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
cd web && npm install
|
4 |
+
pipx install poetry
|
5 |
+
|
6 |
+
echo 'alias start-api="cd /workspaces/dify/api && poetry run python -m flask run --host 0.0.0.0 --port=5001 --debug"' >> ~/.bashrc
|
7 |
+
echo 'alias start-worker="cd /workspaces/dify/api && poetry run python -m celery -A app.celery worker -P gevent -c 1 --loglevel INFO -Q dataset,generation,mail,ops_trace,app_deletion"' >> ~/.bashrc
|
8 |
+
echo 'alias start-web="cd /workspaces/dify/web && npm run dev"' >> ~/.bashrc
|
9 |
+
echo 'alias start-containers="cd /workspaces/dify/docker && docker-compose -f docker-compose.middleware.yaml -p dify up -d"' >> ~/.bashrc
|
10 |
+
echo 'alias stop-containers="cd /workspaces/dify/docker && docker-compose -f docker-compose.middleware.yaml -p dify down"' >> ~/.bashrc
|
11 |
+
|
12 |
+
source /home/vscode/.bashrc
|
.devcontainer/post_start_command.sh
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
cd api && poetry install
|
.devcontainer/troubleshooting.png
ADDED
![]() |
.github/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Dify Code of Conduct
|
2 |
+
|
3 |
+
## Our Pledge
|
4 |
+
|
5 |
+
We as members, contributors, and leaders pledge to make participation in our
|
6 |
+
community a harassment-free experience for everyone, regardless of age, body
|
7 |
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
8 |
+
identity and expression, level of experience, education, socio-economic status,
|
9 |
+
nationality, personal appearance, race, caste, color, religion, or sexual identity
|
10 |
+
and orientation.
|
11 |
+
|
12 |
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
13 |
+
diverse, inclusive, and healthy community.
|
14 |
+
|
15 |
+
## Our Standards
|
16 |
+
|
17 |
+
Examples of behavior that contributes to a positive environment for our
|
18 |
+
community include:
|
19 |
+
|
20 |
+
* Demonstrating empathy and kindness toward other people
|
21 |
+
* Being respectful of differing opinions, viewpoints, and experiences
|
22 |
+
* Giving and gracefully accepting constructive feedback
|
23 |
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
24 |
+
and learning from the experience
|
25 |
+
* Focusing on what is best not just for us as individuals, but for the
|
26 |
+
overall community
|
27 |
+
|
28 |
+
Examples of unacceptable behavior include:
|
29 |
+
|
30 |
+
* The use of sexualized language or imagery, and sexual attention or
|
31 |
+
advances of any kind
|
32 |
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
33 |
+
* Public or private harassment
|
34 |
+
* Publishing others' private information, such as a physical or email
|
35 |
+
address, without their explicit permission
|
36 |
+
* Other conduct which could reasonably be considered inappropriate in a
|
37 |
+
professional setting
|
38 |
+
|
39 |
+
## Language Policy
|
40 |
+
|
41 |
+
To facilitate clear and effective communication, all discussions, comments, documentation, and pull requests in this project should be conducted in English. This ensures that all contributors can participate and collaborate effectively.
|
42 |
+
|
43 |
+
|
.github/DISCUSSION_TEMPLATE/general.yml
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
title: "General Discussion"
|
2 |
+
body:
|
3 |
+
- type: checkboxes
|
4 |
+
attributes:
|
5 |
+
label: Self Checks
|
6 |
+
description: "To make sure we get to you in time, please check the following :)"
|
7 |
+
options:
|
8 |
+
- label: I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones.
|
9 |
+
required: true
|
10 |
+
- label: I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)).
|
11 |
+
required: true
|
12 |
+
- label: "[FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)"
|
13 |
+
required: true
|
14 |
+
- label: "Please do not modify this template :) and fill in all the required fields."
|
15 |
+
required: true
|
16 |
+
- type: textarea
|
17 |
+
attributes:
|
18 |
+
label: Content
|
19 |
+
placeholder: Please describe the content you would like to discuss.
|
20 |
+
validations:
|
21 |
+
required: true
|
22 |
+
- type: markdown
|
23 |
+
attributes:
|
24 |
+
value: Please limit one request per issue.
|
.github/DISCUSSION_TEMPLATE/help.yml
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
title: "Help"
|
2 |
+
body:
|
3 |
+
- type: checkboxes
|
4 |
+
attributes:
|
5 |
+
label: Self Checks
|
6 |
+
description: "To make sure we get to you in time, please check the following :)"
|
7 |
+
options:
|
8 |
+
- label: I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones.
|
9 |
+
required: true
|
10 |
+
- label: I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)).
|
11 |
+
required: true
|
12 |
+
- label: "[FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)"
|
13 |
+
required: true
|
14 |
+
- label: "Please do not modify this template :) and fill in all the required fields."
|
15 |
+
required: true
|
16 |
+
- type: textarea
|
17 |
+
attributes:
|
18 |
+
label: 1. Is this request related to a challenge you're experiencing? Tell me about your story.
|
19 |
+
placeholder: Please describe the specific scenario or problem you're facing as clearly as possible. For instance "I was trying to use [feature] for [specific task], and [what happened]... It was frustrating because...."
|
20 |
+
validations:
|
21 |
+
required: true
|
22 |
+
- type: textarea
|
23 |
+
attributes:
|
24 |
+
label: 2. Additional context or comments
|
25 |
+
placeholder: (Any other information, comments, documentations, links, or screenshots that would provide more clarity. This is the place to add anything else not covered above.)
|
26 |
+
validations:
|
27 |
+
required: false
|
28 |
+
- type: markdown
|
29 |
+
attributes:
|
30 |
+
value: Please limit one request per issue.
|
.github/DISCUSSION_TEMPLATE/suggestion.yml
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
title: Suggestions for New Features
|
2 |
+
body:
|
3 |
+
- type: checkboxes
|
4 |
+
attributes:
|
5 |
+
label: Self Checks
|
6 |
+
description: "To make sure we get to you in time, please check the following :)"
|
7 |
+
options:
|
8 |
+
- label: I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones.
|
9 |
+
required: true
|
10 |
+
- label: I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)).
|
11 |
+
required: true
|
12 |
+
- label: "[FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)"
|
13 |
+
required: true
|
14 |
+
- label: "Please do not modify this template :) and fill in all the required fields."
|
15 |
+
required: true
|
16 |
+
- type: textarea
|
17 |
+
attributes:
|
18 |
+
label: 1. Is this request related to a challenge you're experiencing? Tell me about your story.
|
19 |
+
placeholder: Please describe the specific scenario or problem you're facing as clearly as possible. For instance "I was trying to use [feature] for [specific task], and [what happened]... It was frustrating because...."
|
20 |
+
validations:
|
21 |
+
required: true
|
22 |
+
- type: textarea
|
23 |
+
attributes:
|
24 |
+
label: 2. Additional context or comments
|
25 |
+
placeholder: (Any other information, comments, documentations, links, or screenshots that would provide more clarity. This is the place to add anything else not covered above.)
|
26 |
+
validations:
|
27 |
+
required: false
|
28 |
+
- type: checkboxes
|
29 |
+
attributes:
|
30 |
+
label: 3. Can you help us with this feature?
|
31 |
+
description: Let us know! This is not a commitment, but a starting point for collaboration.
|
32 |
+
options:
|
33 |
+
- label: I am interested in contributing to this feature.
|
34 |
+
required: false
|
35 |
+
- type: markdown
|
36 |
+
attributes:
|
37 |
+
value: Please limit one request per issue.
|
.github/ISSUE_TEMPLATE/bug_report.yml
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: "🕷️ Bug report"
|
2 |
+
description: Report errors or unexpected behavior
|
3 |
+
labels:
|
4 |
+
- bug
|
5 |
+
body:
|
6 |
+
- type: checkboxes
|
7 |
+
attributes:
|
8 |
+
label: Self Checks
|
9 |
+
description: "To make sure we get to you in time, please check the following :)"
|
10 |
+
options:
|
11 |
+
- label: This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general).
|
12 |
+
required: true
|
13 |
+
- label: I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones.
|
14 |
+
required: true
|
15 |
+
- label: I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)).
|
16 |
+
required: true
|
17 |
+
- label: "[FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)"
|
18 |
+
required: true
|
19 |
+
- label: "Please do not modify this template :) and fill in all the required fields."
|
20 |
+
required: true
|
21 |
+
|
22 |
+
- type: input
|
23 |
+
attributes:
|
24 |
+
label: Dify version
|
25 |
+
description: See about section in Dify console
|
26 |
+
validations:
|
27 |
+
required: true
|
28 |
+
|
29 |
+
- type: dropdown
|
30 |
+
attributes:
|
31 |
+
label: Cloud or Self Hosted
|
32 |
+
description: How / Where was Dify installed from?
|
33 |
+
multiple: true
|
34 |
+
options:
|
35 |
+
- Cloud
|
36 |
+
- Self Hosted (Docker)
|
37 |
+
- Self Hosted (Source)
|
38 |
+
validations:
|
39 |
+
required: true
|
40 |
+
|
41 |
+
- type: textarea
|
42 |
+
attributes:
|
43 |
+
label: Steps to reproduce
|
44 |
+
description: We highly suggest including screenshots and a bug report log. Please use the right markdown syntax for code blocks.
|
45 |
+
placeholder: Having detailed steps helps us reproduce the bug.
|
46 |
+
validations:
|
47 |
+
required: true
|
48 |
+
|
49 |
+
- type: textarea
|
50 |
+
attributes:
|
51 |
+
label: ✔️ Expected Behavior
|
52 |
+
placeholder: What were you expecting?
|
53 |
+
validations:
|
54 |
+
required: false
|
55 |
+
|
56 |
+
- type: textarea
|
57 |
+
attributes:
|
58 |
+
label: ❌ Actual Behavior
|
59 |
+
placeholder: What happened instead?
|
60 |
+
validations:
|
61 |
+
required: false
|
.github/ISSUE_TEMPLATE/config.yml
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
blank_issues_enabled: false
|
2 |
+
contact_links:
|
3 |
+
- name: "\U0001F4E7 Discussions"
|
4 |
+
url: https://github.com/langgenius/dify/discussions/categories/general
|
5 |
+
about: General discussions and request help from the community
|
.github/ISSUE_TEMPLATE/document_issue.yml
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: "📚 Documentation Issue"
|
2 |
+
description: Report issues in our documentation
|
3 |
+
labels:
|
4 |
+
- documentation
|
5 |
+
body:
|
6 |
+
- type: checkboxes
|
7 |
+
attributes:
|
8 |
+
label: Self Checks
|
9 |
+
description: "To make sure we get to you in time, please check the following :)"
|
10 |
+
options:
|
11 |
+
- label: I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones.
|
12 |
+
required: true
|
13 |
+
- label: I confirm that I am using English to submit report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)).
|
14 |
+
required: true
|
15 |
+
- label: "[FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)"
|
16 |
+
required: true
|
17 |
+
- label: "Please do not modify this template :) and fill in all the required fields."
|
18 |
+
required: true
|
19 |
+
- type: textarea
|
20 |
+
attributes:
|
21 |
+
label: Provide a description of requested docs changes
|
22 |
+
placeholder: Briefly describe which document needs to be corrected and why.
|
23 |
+
validations:
|
24 |
+
required: true
|
.github/ISSUE_TEMPLATE/feature_request.yml
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: "⭐ Feature or enhancement request"
|
2 |
+
description: Propose something new.
|
3 |
+
labels:
|
4 |
+
- enhancement
|
5 |
+
body:
|
6 |
+
- type: checkboxes
|
7 |
+
attributes:
|
8 |
+
label: Self Checks
|
9 |
+
description: "To make sure we get to you in time, please check the following :)"
|
10 |
+
options:
|
11 |
+
- label: I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones.
|
12 |
+
required: true
|
13 |
+
- label: I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)).
|
14 |
+
required: true
|
15 |
+
- label: "[FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)"
|
16 |
+
required: true
|
17 |
+
- label: "Please do not modify this template :) and fill in all the required fields."
|
18 |
+
required: true
|
19 |
+
- type: textarea
|
20 |
+
attributes:
|
21 |
+
label: 1. Is this request related to a challenge you're experiencing? Tell me about your story.
|
22 |
+
placeholder: Please describe the specific scenario or problem you're facing as clearly as possible. For instance "I was trying to use [feature] for [specific task], and [what happened]... It was frustrating because...."
|
23 |
+
validations:
|
24 |
+
required: true
|
25 |
+
- type: textarea
|
26 |
+
attributes:
|
27 |
+
label: 2. Additional context or comments
|
28 |
+
placeholder: (Any other information, comments, documentations, links, or screenshots that would provide more clarity. This is the place to add anything else not covered above.)
|
29 |
+
validations:
|
30 |
+
required: false
|
31 |
+
- type: checkboxes
|
32 |
+
attributes:
|
33 |
+
label: 3. Can you help us with this feature?
|
34 |
+
description: Let us know! This is not a commitment, but a starting point for collaboration.
|
35 |
+
options:
|
36 |
+
- label: I am interested in contributing to this feature.
|
37 |
+
required: false
|
38 |
+
- type: markdown
|
39 |
+
attributes:
|
40 |
+
value: Please limit one request per issue.
|
.github/ISSUE_TEMPLATE/translation_issue.yml
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: "🌐 Localization/Translation issue"
|
2 |
+
description: Report incorrect translations. [please use English :)]
|
3 |
+
labels:
|
4 |
+
- translation
|
5 |
+
body:
|
6 |
+
- type: checkboxes
|
7 |
+
attributes:
|
8 |
+
label: Self Checks
|
9 |
+
description: "To make sure we get to you in time, please check the following :)"
|
10 |
+
options:
|
11 |
+
- label: I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones.
|
12 |
+
required: true
|
13 |
+
- label: I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)).
|
14 |
+
required: true
|
15 |
+
- label: "[FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)"
|
16 |
+
required: true
|
17 |
+
- label: "Please do not modify this template :) and fill in all the required fields."
|
18 |
+
required: true
|
19 |
+
- type: input
|
20 |
+
attributes:
|
21 |
+
label: Dify version
|
22 |
+
description: Hover over system tray icon or look at Settings
|
23 |
+
validations:
|
24 |
+
required: true
|
25 |
+
- type: input
|
26 |
+
attributes:
|
27 |
+
label: Utility with translation issue
|
28 |
+
placeholder: Some area
|
29 |
+
description: Please input here the utility with the translation issue
|
30 |
+
validations:
|
31 |
+
required: true
|
32 |
+
- type: input
|
33 |
+
attributes:
|
34 |
+
label: 🌐 Language affected
|
35 |
+
placeholder: "German"
|
36 |
+
validations:
|
37 |
+
required: true
|
38 |
+
- type: textarea
|
39 |
+
attributes:
|
40 |
+
label: ❌ Actual phrase(s)
|
41 |
+
placeholder: What is there? Please include a screenshot as that is extremely helpful.
|
42 |
+
validations:
|
43 |
+
required: true
|
44 |
+
- type: textarea
|
45 |
+
attributes:
|
46 |
+
label: ✔️ Expected phrase(s)
|
47 |
+
placeholder: What was expected?
|
48 |
+
validations:
|
49 |
+
required: true
|
50 |
+
- type: textarea
|
51 |
+
attributes:
|
52 |
+
label: ℹ Why is the current translation wrong
|
53 |
+
placeholder: Why do you feel this is incorrect?
|
54 |
+
validations:
|
55 |
+
required: true
|
.github/actions/setup-poetry/action.yml
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Setup Poetry and Python
|
2 |
+
|
3 |
+
inputs:
|
4 |
+
python-version:
|
5 |
+
description: Python version to use and the Poetry installed with
|
6 |
+
required: true
|
7 |
+
default: '3.11'
|
8 |
+
poetry-version:
|
9 |
+
description: Poetry version to set up
|
10 |
+
required: true
|
11 |
+
default: '2.0.1'
|
12 |
+
poetry-lockfile:
|
13 |
+
description: Path to the Poetry lockfile to restore cache from
|
14 |
+
required: true
|
15 |
+
default: ''
|
16 |
+
|
17 |
+
runs:
|
18 |
+
using: composite
|
19 |
+
steps:
|
20 |
+
- name: Set up Python ${{ inputs.python-version }}
|
21 |
+
uses: actions/setup-python@v5
|
22 |
+
with:
|
23 |
+
python-version: ${{ inputs.python-version }}
|
24 |
+
cache: pip
|
25 |
+
|
26 |
+
- name: Install Poetry
|
27 |
+
shell: bash
|
28 |
+
run: pip install poetry==${{ inputs.poetry-version }}
|
29 |
+
|
30 |
+
- name: Restore Poetry cache
|
31 |
+
if: ${{ inputs.poetry-lockfile != '' }}
|
32 |
+
uses: actions/setup-python@v5
|
33 |
+
with:
|
34 |
+
python-version: ${{ inputs.python-version }}
|
35 |
+
cache: poetry
|
36 |
+
cache-dependency-path: ${{ inputs.poetry-lockfile }}
|
.github/linters/.hadolint.yaml
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
failure-threshold: "error"
|
.github/linters/.isort.cfg
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
[settings]
|
2 |
+
line_length=120
|
.github/linters/.yaml-lint.yml
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
|
3 |
+
extends: default
|
4 |
+
|
5 |
+
rules:
|
6 |
+
brackets:
|
7 |
+
max-spaces-inside: 1
|
8 |
+
comments-indentation: disable
|
9 |
+
document-start: disable
|
10 |
+
line-length: disable
|
11 |
+
truthy: disable
|
.github/pull_request_template.md
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Summary
|
2 |
+
|
3 |
+
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
|
4 |
+
|
5 |
+
> [!Tip]
|
6 |
+
> Close issue syntax: `Fixes #<issue number>` or `Resolves #<issue number>`, see [documentation](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword) for more details.
|
7 |
+
|
8 |
+
|
9 |
+
# Screenshots
|
10 |
+
|
11 |
+
| Before | After |
|
12 |
+
|--------|-------|
|
13 |
+
| ... | ... |
|
14 |
+
|
15 |
+
# Checklist
|
16 |
+
|
17 |
+
> [!IMPORTANT]
|
18 |
+
> Please review the checklist below before submitting your pull request.
|
19 |
+
|
20 |
+
- [ ] This change requires a documentation update, included: [Dify Document](https://github.com/langgenius/dify-docs)
|
21 |
+
- [x] I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
|
22 |
+
- [x] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
|
23 |
+
- [x] I've updated the documentation accordingly.
|
24 |
+
- [x] I ran `dev/reformat`(backend) and `cd web && npx lint-staged`(frontend) to appease the lint gods
|
25 |
+
|
.github/workflows/api-tests.yml
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Run Pytest
|
2 |
+
|
3 |
+
on:
|
4 |
+
pull_request:
|
5 |
+
branches:
|
6 |
+
- main
|
7 |
+
paths:
|
8 |
+
- api/**
|
9 |
+
- docker/**
|
10 |
+
- .github/workflows/api-tests.yml
|
11 |
+
|
12 |
+
concurrency:
|
13 |
+
group: api-tests-${{ github.head_ref || github.run_id }}
|
14 |
+
cancel-in-progress: true
|
15 |
+
|
16 |
+
jobs:
|
17 |
+
test:
|
18 |
+
name: API Tests
|
19 |
+
runs-on: ubuntu-latest
|
20 |
+
strategy:
|
21 |
+
matrix:
|
22 |
+
python-version:
|
23 |
+
- "3.11"
|
24 |
+
- "3.12"
|
25 |
+
|
26 |
+
steps:
|
27 |
+
- name: Checkout code
|
28 |
+
uses: actions/checkout@v4
|
29 |
+
with:
|
30 |
+
fetch-depth: 0
|
31 |
+
persist-credentials: false
|
32 |
+
|
33 |
+
- name: Setup Poetry and Python ${{ matrix.python-version }}
|
34 |
+
uses: ./.github/actions/setup-poetry
|
35 |
+
with:
|
36 |
+
python-version: ${{ matrix.python-version }}
|
37 |
+
poetry-lockfile: api/poetry.lock
|
38 |
+
|
39 |
+
- name: Check Poetry lockfile
|
40 |
+
run: |
|
41 |
+
poetry check -C api --lock
|
42 |
+
poetry show -C api
|
43 |
+
|
44 |
+
- name: Install dependencies
|
45 |
+
run: poetry install -C api --with dev
|
46 |
+
|
47 |
+
- name: Check dependencies in pyproject.toml
|
48 |
+
run: poetry run -P api bash dev/pytest/pytest_artifacts.sh
|
49 |
+
|
50 |
+
- name: Run Unit tests
|
51 |
+
run: poetry run -P api bash dev/pytest/pytest_unit_tests.sh
|
52 |
+
|
53 |
+
- name: Run ModelRuntime
|
54 |
+
run: poetry run -P api bash dev/pytest/pytest_model_runtime.sh
|
55 |
+
|
56 |
+
- name: Run dify config tests
|
57 |
+
run: poetry run -P api python dev/pytest/pytest_config_tests.py
|
58 |
+
|
59 |
+
- name: Run Tool
|
60 |
+
run: poetry run -P api bash dev/pytest/pytest_tools.sh
|
61 |
+
|
62 |
+
- name: Run mypy
|
63 |
+
run: |
|
64 |
+
poetry run -C api python -m mypy --install-types --non-interactive .
|
65 |
+
|
66 |
+
- name: Set up dotenvs
|
67 |
+
run: |
|
68 |
+
cp docker/.env.example docker/.env
|
69 |
+
cp docker/middleware.env.example docker/middleware.env
|
70 |
+
|
71 |
+
- name: Expose Service Ports
|
72 |
+
run: sh .github/workflows/expose_service_ports.sh
|
73 |
+
|
74 |
+
- name: Set up Sandbox
|
75 |
+
uses: hoverkraft-tech/[email protected]
|
76 |
+
with:
|
77 |
+
compose-file: |
|
78 |
+
docker/docker-compose.middleware.yaml
|
79 |
+
services: |
|
80 |
+
sandbox
|
81 |
+
ssrf_proxy
|
82 |
+
|
83 |
+
- name: Run Workflow
|
84 |
+
run: poetry run -P api bash dev/pytest/pytest_workflow.sh
|
.github/workflows/build-push.yml
ADDED
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Build and Push API & Web
|
2 |
+
|
3 |
+
on:
|
4 |
+
push:
|
5 |
+
branches:
|
6 |
+
- "main"
|
7 |
+
- "deploy/dev"
|
8 |
+
release:
|
9 |
+
types: [published]
|
10 |
+
|
11 |
+
concurrency:
|
12 |
+
group: build-push-${{ github.head_ref || github.run_id }}
|
13 |
+
cancel-in-progress: true
|
14 |
+
|
15 |
+
env:
|
16 |
+
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
|
17 |
+
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
18 |
+
DIFY_WEB_IMAGE_NAME: ${{ vars.DIFY_WEB_IMAGE_NAME || 'langgenius/dify-web' }}
|
19 |
+
DIFY_API_IMAGE_NAME: ${{ vars.DIFY_API_IMAGE_NAME || 'langgenius/dify-api' }}
|
20 |
+
|
21 |
+
jobs:
|
22 |
+
build:
|
23 |
+
runs-on: ${{ matrix.platform == 'linux/arm64' && 'arm64_runner' || 'ubuntu-latest' }}
|
24 |
+
if: github.repository == 'langgenius/dify'
|
25 |
+
strategy:
|
26 |
+
matrix:
|
27 |
+
include:
|
28 |
+
- service_name: "build-api-amd64"
|
29 |
+
image_name_env: "DIFY_API_IMAGE_NAME"
|
30 |
+
context: "api"
|
31 |
+
platform: linux/amd64
|
32 |
+
- service_name: "build-api-arm64"
|
33 |
+
image_name_env: "DIFY_API_IMAGE_NAME"
|
34 |
+
context: "api"
|
35 |
+
platform: linux/arm64
|
36 |
+
- service_name: "build-web-amd64"
|
37 |
+
image_name_env: "DIFY_WEB_IMAGE_NAME"
|
38 |
+
context: "web"
|
39 |
+
platform: linux/amd64
|
40 |
+
- service_name: "build-web-arm64"
|
41 |
+
image_name_env: "DIFY_WEB_IMAGE_NAME"
|
42 |
+
context: "web"
|
43 |
+
platform: linux/arm64
|
44 |
+
|
45 |
+
steps:
|
46 |
+
- name: Prepare
|
47 |
+
run: |
|
48 |
+
platform=${{ matrix.platform }}
|
49 |
+
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
|
50 |
+
|
51 |
+
- name: Login to Docker Hub
|
52 |
+
uses: docker/login-action@v3
|
53 |
+
with:
|
54 |
+
username: ${{ env.DOCKERHUB_USER }}
|
55 |
+
password: ${{ env.DOCKERHUB_TOKEN }}
|
56 |
+
|
57 |
+
- name: Set up QEMU
|
58 |
+
uses: docker/setup-qemu-action@v3
|
59 |
+
|
60 |
+
- name: Set up Docker Buildx
|
61 |
+
uses: docker/setup-buildx-action@v3
|
62 |
+
|
63 |
+
- name: Extract metadata for Docker
|
64 |
+
id: meta
|
65 |
+
uses: docker/metadata-action@v5
|
66 |
+
with:
|
67 |
+
images: ${{ env[matrix.image_name_env] }}
|
68 |
+
|
69 |
+
- name: Build Docker image
|
70 |
+
id: build
|
71 |
+
uses: docker/build-push-action@v6
|
72 |
+
with:
|
73 |
+
context: "{{defaultContext}}:${{ matrix.context }}"
|
74 |
+
platforms: ${{ matrix.platform }}
|
75 |
+
build-args: COMMIT_SHA=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
|
76 |
+
labels: ${{ steps.meta.outputs.labels }}
|
77 |
+
outputs: type=image,name=${{ env[matrix.image_name_env] }},push-by-digest=true,name-canonical=true,push=true
|
78 |
+
cache-from: type=gha,scope=${{ matrix.service_name }}
|
79 |
+
cache-to: type=gha,mode=max,scope=${{ matrix.service_name }}
|
80 |
+
|
81 |
+
- name: Export digest
|
82 |
+
env:
|
83 |
+
DIGEST: ${{ steps.build.outputs.digest }}
|
84 |
+
run: |
|
85 |
+
mkdir -p /tmp/digests
|
86 |
+
sanitized_digest=${DIGEST#sha256:}
|
87 |
+
touch "/tmp/digests/${sanitized_digest}"
|
88 |
+
|
89 |
+
- name: Upload digest
|
90 |
+
uses: actions/upload-artifact@v4
|
91 |
+
with:
|
92 |
+
name: digests-${{ matrix.context }}-${{ env.PLATFORM_PAIR }}
|
93 |
+
path: /tmp/digests/*
|
94 |
+
if-no-files-found: error
|
95 |
+
retention-days: 1
|
96 |
+
|
97 |
+
create-manifest:
|
98 |
+
needs: build
|
99 |
+
runs-on: ubuntu-latest
|
100 |
+
if: github.repository == 'langgenius/dify'
|
101 |
+
strategy:
|
102 |
+
matrix:
|
103 |
+
include:
|
104 |
+
- service_name: "merge-api-images"
|
105 |
+
image_name_env: "DIFY_API_IMAGE_NAME"
|
106 |
+
context: "api"
|
107 |
+
- service_name: "merge-web-images"
|
108 |
+
image_name_env: "DIFY_WEB_IMAGE_NAME"
|
109 |
+
context: "web"
|
110 |
+
steps:
|
111 |
+
- name: Download digests
|
112 |
+
uses: actions/download-artifact@v4
|
113 |
+
with:
|
114 |
+
path: /tmp/digests
|
115 |
+
pattern: digests-${{ matrix.context }}-*
|
116 |
+
merge-multiple: true
|
117 |
+
|
118 |
+
- name: Login to Docker Hub
|
119 |
+
uses: docker/login-action@v3
|
120 |
+
with:
|
121 |
+
username: ${{ env.DOCKERHUB_USER }}
|
122 |
+
password: ${{ env.DOCKERHUB_TOKEN }}
|
123 |
+
|
124 |
+
- name: Extract metadata for Docker
|
125 |
+
id: meta
|
126 |
+
uses: docker/metadata-action@v5
|
127 |
+
with:
|
128 |
+
images: ${{ env[matrix.image_name_env] }}
|
129 |
+
tags: |
|
130 |
+
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') && !contains(github.ref, '-') }}
|
131 |
+
type=ref,event=branch
|
132 |
+
type=sha,enable=true,priority=100,prefix=,suffix=,format=long
|
133 |
+
type=raw,value=${{ github.ref_name }},enable=${{ startsWith(github.ref, 'refs/tags/') }}
|
134 |
+
|
135 |
+
- name: Create manifest list and push
|
136 |
+
working-directory: /tmp/digests
|
137 |
+
env:
|
138 |
+
IMAGE_NAME: ${{ env[matrix.image_name_env] }}
|
139 |
+
run: |
|
140 |
+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
|
141 |
+
$(printf "$IMAGE_NAME@sha256:%s " *)
|
142 |
+
|
143 |
+
- name: Inspect image
|
144 |
+
env:
|
145 |
+
IMAGE_NAME: ${{ env[matrix.image_name_env] }}
|
146 |
+
IMAGE_VERSION: ${{ steps.meta.outputs.version }}
|
147 |
+
run: |
|
148 |
+
docker buildx imagetools inspect "$IMAGE_NAME:$IMAGE_VERSION"
|
.github/workflows/db-migration-test.yml
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: DB Migration Test
|
2 |
+
|
3 |
+
on:
|
4 |
+
pull_request:
|
5 |
+
branches:
|
6 |
+
- main
|
7 |
+
paths:
|
8 |
+
- api/migrations/**
|
9 |
+
- .github/workflows/db-migration-test.yml
|
10 |
+
|
11 |
+
concurrency:
|
12 |
+
group: db-migration-test-${{ github.ref }}
|
13 |
+
cancel-in-progress: true
|
14 |
+
|
15 |
+
jobs:
|
16 |
+
db-migration-test:
|
17 |
+
runs-on: ubuntu-latest
|
18 |
+
|
19 |
+
steps:
|
20 |
+
- name: Checkout code
|
21 |
+
uses: actions/checkout@v4
|
22 |
+
with:
|
23 |
+
fetch-depth: 0
|
24 |
+
persist-credentials: false
|
25 |
+
|
26 |
+
- name: Setup Poetry and Python
|
27 |
+
uses: ./.github/actions/setup-poetry
|
28 |
+
with:
|
29 |
+
poetry-lockfile: api/poetry.lock
|
30 |
+
|
31 |
+
- name: Install dependencies
|
32 |
+
run: poetry install -C api
|
33 |
+
|
34 |
+
- name: Prepare middleware env
|
35 |
+
run: |
|
36 |
+
cd docker
|
37 |
+
cp middleware.env.example middleware.env
|
38 |
+
|
39 |
+
- name: Set up Middlewares
|
40 |
+
uses: hoverkraft-tech/[email protected]
|
41 |
+
with:
|
42 |
+
compose-file: |
|
43 |
+
docker/docker-compose.middleware.yaml
|
44 |
+
services: |
|
45 |
+
db
|
46 |
+
redis
|
47 |
+
|
48 |
+
- name: Prepare configs
|
49 |
+
run: |
|
50 |
+
cd api
|
51 |
+
cp .env.example .env
|
52 |
+
|
53 |
+
- name: Run DB Migration
|
54 |
+
env:
|
55 |
+
DEBUG: true
|
56 |
+
run: |
|
57 |
+
cd api
|
58 |
+
poetry run python -m flask upgrade-db
|
.github/workflows/deploy-dev.yml
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Deploy Dev
|
2 |
+
|
3 |
+
on:
|
4 |
+
workflow_run:
|
5 |
+
workflows: ["Build and Push API & Web"]
|
6 |
+
branches:
|
7 |
+
- "deploy/dev"
|
8 |
+
types:
|
9 |
+
- completed
|
10 |
+
|
11 |
+
jobs:
|
12 |
+
deploy:
|
13 |
+
runs-on: ubuntu-latest
|
14 |
+
if: |
|
15 |
+
github.event.workflow_run.conclusion == 'success'
|
16 |
+
steps:
|
17 |
+
- name: Deploy to server
|
18 |
+
uses: appleboy/[email protected]
|
19 |
+
with:
|
20 |
+
host: ${{ secrets.SSH_HOST }}
|
21 |
+
username: ${{ secrets.SSH_USER }}
|
22 |
+
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
23 |
+
script: |
|
24 |
+
${{ vars.SSH_SCRIPT || secrets.SSH_SCRIPT }}
|
.github/workflows/docker-build.yml
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Build docker image
|
2 |
+
|
3 |
+
on:
|
4 |
+
pull_request:
|
5 |
+
branches:
|
6 |
+
- "main"
|
7 |
+
paths:
|
8 |
+
- api/Dockerfile
|
9 |
+
- web/Dockerfile
|
10 |
+
|
11 |
+
concurrency:
|
12 |
+
group: docker-build-${{ github.head_ref || github.run_id }}
|
13 |
+
cancel-in-progress: true
|
14 |
+
|
15 |
+
jobs:
|
16 |
+
build-docker:
|
17 |
+
runs-on: ubuntu-latest
|
18 |
+
strategy:
|
19 |
+
matrix:
|
20 |
+
include:
|
21 |
+
- service_name: "api-amd64"
|
22 |
+
platform: linux/amd64
|
23 |
+
context: "api"
|
24 |
+
- service_name: "api-arm64"
|
25 |
+
platform: linux/arm64
|
26 |
+
context: "api"
|
27 |
+
- service_name: "web-amd64"
|
28 |
+
platform: linux/amd64
|
29 |
+
context: "web"
|
30 |
+
- service_name: "web-arm64"
|
31 |
+
platform: linux/arm64
|
32 |
+
context: "web"
|
33 |
+
steps:
|
34 |
+
- name: Set up QEMU
|
35 |
+
uses: docker/setup-qemu-action@v3
|
36 |
+
|
37 |
+
- name: Set up Docker Buildx
|
38 |
+
uses: docker/setup-buildx-action@v3
|
39 |
+
|
40 |
+
- name: Build Docker Image
|
41 |
+
uses: docker/build-push-action@v6
|
42 |
+
with:
|
43 |
+
push: false
|
44 |
+
context: "{{defaultContext}}:${{ matrix.context }}"
|
45 |
+
platforms: ${{ matrix.platform }}
|
46 |
+
cache-from: type=gha
|
47 |
+
cache-to: type=gha,mode=max
|
.github/workflows/expose_service_ports.sh
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
yq eval '.services.weaviate.ports += ["8080:8080"]' -i docker/docker-compose.yaml
|
4 |
+
yq eval '.services.qdrant.ports += ["6333:6333"]' -i docker/docker-compose.yaml
|
5 |
+
yq eval '.services.chroma.ports += ["8000:8000"]' -i docker/docker-compose.yaml
|
6 |
+
yq eval '.services["milvus-standalone"].ports += ["19530:19530"]' -i docker/docker-compose.yaml
|
7 |
+
yq eval '.services.pgvector.ports += ["5433:5432"]' -i docker/docker-compose.yaml
|
8 |
+
yq eval '.services["pgvecto-rs"].ports += ["5431:5432"]' -i docker/docker-compose.yaml
|
9 |
+
yq eval '.services["elasticsearch"].ports += ["9200:9200"]' -i docker/docker-compose.yaml
|
10 |
+
yq eval '.services.couchbase-server.ports += ["8091-8096:8091-8096"]' -i docker/docker-compose.yaml
|
11 |
+
yq eval '.services.couchbase-server.ports += ["11210:11210"]' -i docker/docker-compose.yaml
|
12 |
+
yq eval '.services.tidb.ports += ["4000:4000"]' -i docker/docker-compose.yaml
|
13 |
+
|
14 |
+
echo "Ports exposed for sandbox, weaviate, tidb, qdrant, chroma, milvus, pgvector, pgvecto-rs, elasticsearch, couchbase"
|
.github/workflows/stale.yml
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
|
2 |
+
#
|
3 |
+
# You can adjust the behavior by modifying this file.
|
4 |
+
# For more information, see:
|
5 |
+
# https://github.com/actions/stale
|
6 |
+
name: Mark stale issues and pull requests
|
7 |
+
|
8 |
+
on:
|
9 |
+
schedule:
|
10 |
+
- cron: '0 3 * * *'
|
11 |
+
|
12 |
+
jobs:
|
13 |
+
stale:
|
14 |
+
|
15 |
+
runs-on: ubuntu-latest
|
16 |
+
permissions:
|
17 |
+
issues: write
|
18 |
+
pull-requests: write
|
19 |
+
|
20 |
+
steps:
|
21 |
+
- uses: actions/stale@v5
|
22 |
+
with:
|
23 |
+
days-before-issue-stale: 15
|
24 |
+
days-before-issue-close: 3
|
25 |
+
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
26 |
+
stale-issue-message: "Close due to it's no longer active, if you have any questions, you can reopen it."
|
27 |
+
stale-pr-message: "Close due to it's no longer active, if you have any questions, you can reopen it."
|
28 |
+
stale-issue-label: 'no-issue-activity'
|
29 |
+
stale-pr-label: 'no-pr-activity'
|
30 |
+
any-of-labels: 'duplicate,question,invalid,wontfix,no-issue-activity,no-pr-activity,enhancement,cant-reproduce,help-wanted'
|
.github/workflows/style.yml
ADDED
@@ -0,0 +1,159 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Style check
|
2 |
+
|
3 |
+
on:
|
4 |
+
pull_request:
|
5 |
+
branches:
|
6 |
+
- main
|
7 |
+
|
8 |
+
concurrency:
|
9 |
+
group: style-${{ github.head_ref || github.run_id }}
|
10 |
+
cancel-in-progress: true
|
11 |
+
|
12 |
+
jobs:
|
13 |
+
python-style:
|
14 |
+
name: Python Style
|
15 |
+
runs-on: ubuntu-latest
|
16 |
+
|
17 |
+
steps:
|
18 |
+
- name: Checkout code
|
19 |
+
uses: actions/checkout@v4
|
20 |
+
with:
|
21 |
+
fetch-depth: 0
|
22 |
+
persist-credentials: false
|
23 |
+
|
24 |
+
- name: Check changed files
|
25 |
+
id: changed-files
|
26 |
+
uses: tj-actions/changed-files@v45
|
27 |
+
with:
|
28 |
+
files: |
|
29 |
+
api/**
|
30 |
+
.github/workflows/style.yml
|
31 |
+
|
32 |
+
- name: Setup Poetry and Python
|
33 |
+
if: steps.changed-files.outputs.any_changed == 'true'
|
34 |
+
uses: ./.github/actions/setup-poetry
|
35 |
+
|
36 |
+
- name: Install dependencies
|
37 |
+
if: steps.changed-files.outputs.any_changed == 'true'
|
38 |
+
run: poetry install -C api --only lint
|
39 |
+
|
40 |
+
- name: Ruff check
|
41 |
+
if: steps.changed-files.outputs.any_changed == 'true'
|
42 |
+
run: |
|
43 |
+
poetry run -C api ruff --version
|
44 |
+
poetry run -C api ruff check ./
|
45 |
+
poetry run -C api ruff format --check ./
|
46 |
+
|
47 |
+
- name: Dotenv check
|
48 |
+
if: steps.changed-files.outputs.any_changed == 'true'
|
49 |
+
run: poetry run -P api dotenv-linter ./api/.env.example ./web/.env.example
|
50 |
+
|
51 |
+
- name: Lint hints
|
52 |
+
if: failure()
|
53 |
+
run: echo "Please run 'dev/reformat' to fix the fixable linting errors."
|
54 |
+
|
55 |
+
web-style:
|
56 |
+
name: Web Style
|
57 |
+
runs-on: ubuntu-latest
|
58 |
+
defaults:
|
59 |
+
run:
|
60 |
+
working-directory: ./web
|
61 |
+
|
62 |
+
steps:
|
63 |
+
- name: Checkout code
|
64 |
+
uses: actions/checkout@v4
|
65 |
+
with:
|
66 |
+
fetch-depth: 0
|
67 |
+
persist-credentials: false
|
68 |
+
|
69 |
+
- name: Check changed files
|
70 |
+
id: changed-files
|
71 |
+
uses: tj-actions/changed-files@v45
|
72 |
+
with:
|
73 |
+
files: web/**
|
74 |
+
|
75 |
+
- name: Setup NodeJS
|
76 |
+
uses: actions/setup-node@v4
|
77 |
+
if: steps.changed-files.outputs.any_changed == 'true'
|
78 |
+
with:
|
79 |
+
node-version: 20
|
80 |
+
cache: yarn
|
81 |
+
cache-dependency-path: ./web/package.json
|
82 |
+
|
83 |
+
- name: Web dependencies
|
84 |
+
if: steps.changed-files.outputs.any_changed == 'true'
|
85 |
+
run: yarn install --frozen-lockfile
|
86 |
+
|
87 |
+
- name: Web style check
|
88 |
+
if: steps.changed-files.outputs.any_changed == 'true'
|
89 |
+
run: yarn run lint
|
90 |
+
|
91 |
+
docker-compose-template:
|
92 |
+
name: Docker Compose Template
|
93 |
+
runs-on: ubuntu-latest
|
94 |
+
|
95 |
+
steps:
|
96 |
+
- name: Checkout code
|
97 |
+
uses: actions/checkout@v4
|
98 |
+
with:
|
99 |
+
fetch-depth: 0
|
100 |
+
persist-credentials: false
|
101 |
+
|
102 |
+
- name: Check changed files
|
103 |
+
id: changed-files
|
104 |
+
uses: tj-actions/changed-files@v45
|
105 |
+
with:
|
106 |
+
files: |
|
107 |
+
docker/generate_docker_compose
|
108 |
+
docker/.env.example
|
109 |
+
docker/docker-compose-template.yaml
|
110 |
+
docker/docker-compose.yaml
|
111 |
+
|
112 |
+
- name: Generate Docker Compose
|
113 |
+
if: steps.changed-files.outputs.any_changed == 'true'
|
114 |
+
run: |
|
115 |
+
cd docker
|
116 |
+
./generate_docker_compose
|
117 |
+
|
118 |
+
- name: Check for changes
|
119 |
+
if: steps.changed-files.outputs.any_changed == 'true'
|
120 |
+
run: git diff --exit-code
|
121 |
+
|
122 |
+
superlinter:
|
123 |
+
name: SuperLinter
|
124 |
+
runs-on: ubuntu-latest
|
125 |
+
|
126 |
+
steps:
|
127 |
+
- name: Checkout code
|
128 |
+
uses: actions/checkout@v4
|
129 |
+
with:
|
130 |
+
fetch-depth: 0
|
131 |
+
persist-credentials: false
|
132 |
+
|
133 |
+
- name: Check changed files
|
134 |
+
id: changed-files
|
135 |
+
uses: tj-actions/changed-files@v45
|
136 |
+
with:
|
137 |
+
files: |
|
138 |
+
**.sh
|
139 |
+
**.yaml
|
140 |
+
**.yml
|
141 |
+
**Dockerfile
|
142 |
+
dev/**
|
143 |
+
|
144 |
+
- name: Super-linter
|
145 |
+
uses: super-linter/super-linter/slim@v7
|
146 |
+
if: steps.changed-files.outputs.any_changed == 'true'
|
147 |
+
env:
|
148 |
+
BASH_SEVERITY: warning
|
149 |
+
DEFAULT_BRANCH: main
|
150 |
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
151 |
+
IGNORE_GENERATED_FILES: true
|
152 |
+
IGNORE_GITIGNORED_FILES: true
|
153 |
+
VALIDATE_BASH: true
|
154 |
+
VALIDATE_BASH_EXEC: true
|
155 |
+
# FIXME: temporarily disabled until api-docker.yaml's run script is fixed for shellcheck
|
156 |
+
# VALIDATE_GITHUB_ACTIONS: true
|
157 |
+
VALIDATE_DOCKERFILE_HADOLINT: true
|
158 |
+
VALIDATE_XML: true
|
159 |
+
VALIDATE_YAML: true
|
.github/workflows/tool-test-sdks.yaml
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Run Unit Test For SDKs
|
2 |
+
|
3 |
+
on:
|
4 |
+
pull_request:
|
5 |
+
branches:
|
6 |
+
- main
|
7 |
+
paths:
|
8 |
+
- sdks/**
|
9 |
+
|
10 |
+
concurrency:
|
11 |
+
group: sdk-tests-${{ github.head_ref || github.run_id }}
|
12 |
+
cancel-in-progress: true
|
13 |
+
|
14 |
+
jobs:
|
15 |
+
build:
|
16 |
+
name: unit test for Node.js SDK
|
17 |
+
runs-on: ubuntu-latest
|
18 |
+
|
19 |
+
strategy:
|
20 |
+
matrix:
|
21 |
+
node-version: [16, 18, 20]
|
22 |
+
|
23 |
+
defaults:
|
24 |
+
run:
|
25 |
+
working-directory: sdks/nodejs-client
|
26 |
+
|
27 |
+
steps:
|
28 |
+
- uses: actions/checkout@v4
|
29 |
+
with:
|
30 |
+
fetch-depth: 0
|
31 |
+
persist-credentials: false
|
32 |
+
|
33 |
+
- name: Use Node.js ${{ matrix.node-version }}
|
34 |
+
uses: actions/setup-node@v4
|
35 |
+
with:
|
36 |
+
node-version: ${{ matrix.node-version }}
|
37 |
+
cache: ''
|
38 |
+
cache-dependency-path: 'yarn.lock'
|
39 |
+
|
40 |
+
- name: Install Dependencies
|
41 |
+
run: yarn install
|
42 |
+
|
43 |
+
- name: Test
|
44 |
+
run: yarn test
|
.github/workflows/translate-i18n-base-on-english.yml
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Check i18n Files and Create PR
|
2 |
+
|
3 |
+
on:
|
4 |
+
pull_request:
|
5 |
+
types: [closed]
|
6 |
+
branches: [main]
|
7 |
+
|
8 |
+
jobs:
|
9 |
+
check-and-update:
|
10 |
+
if: github.event.pull_request.merged == true
|
11 |
+
runs-on: ubuntu-latest
|
12 |
+
defaults:
|
13 |
+
run:
|
14 |
+
working-directory: web
|
15 |
+
steps:
|
16 |
+
- uses: actions/checkout@v4
|
17 |
+
with:
|
18 |
+
fetch-depth: 2 # last 2 commits
|
19 |
+
persist-credentials: false
|
20 |
+
|
21 |
+
- name: Check for file changes in i18n/en-US
|
22 |
+
id: check_files
|
23 |
+
run: |
|
24 |
+
recent_commit_sha=$(git rev-parse HEAD)
|
25 |
+
second_recent_commit_sha=$(git rev-parse HEAD~1)
|
26 |
+
changed_files=$(git diff --name-only $recent_commit_sha $second_recent_commit_sha -- 'i18n/en-US/*.ts')
|
27 |
+
echo "Changed files: $changed_files"
|
28 |
+
if [ -n "$changed_files" ]; then
|
29 |
+
echo "FILES_CHANGED=true" >> $GITHUB_ENV
|
30 |
+
else
|
31 |
+
echo "FILES_CHANGED=false" >> $GITHUB_ENV
|
32 |
+
fi
|
33 |
+
|
34 |
+
- name: Set up Node.js
|
35 |
+
if: env.FILES_CHANGED == 'true'
|
36 |
+
uses: actions/setup-node@v2
|
37 |
+
with:
|
38 |
+
node-version: 'lts/*'
|
39 |
+
|
40 |
+
- name: Install dependencies
|
41 |
+
if: env.FILES_CHANGED == 'true'
|
42 |
+
run: yarn install --frozen-lockfile
|
43 |
+
|
44 |
+
- name: Run npm script
|
45 |
+
if: env.FILES_CHANGED == 'true'
|
46 |
+
run: npm run auto-gen-i18n
|
47 |
+
|
48 |
+
- name: Create Pull Request
|
49 |
+
if: env.FILES_CHANGED == 'true'
|
50 |
+
uses: peter-evans/create-pull-request@v6
|
51 |
+
with:
|
52 |
+
commit-message: Update i18n files based on en-US changes
|
53 |
+
title: 'chore: translate i18n files'
|
54 |
+
body: This PR was automatically created to update i18n files based on changes in en-US locale.
|
55 |
+
branch: chore/automated-i18n-updates
|
.github/workflows/vdb-tests.yml
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Run VDB Tests
|
2 |
+
|
3 |
+
on:
|
4 |
+
pull_request:
|
5 |
+
branches:
|
6 |
+
- main
|
7 |
+
paths:
|
8 |
+
- api/core/rag/datasource/**
|
9 |
+
- docker/**
|
10 |
+
- .github/workflows/vdb-tests.yml
|
11 |
+
- api/poetry.lock
|
12 |
+
- api/pyproject.toml
|
13 |
+
|
14 |
+
concurrency:
|
15 |
+
group: vdb-tests-${{ github.head_ref || github.run_id }}
|
16 |
+
cancel-in-progress: true
|
17 |
+
|
18 |
+
jobs:
|
19 |
+
test:
|
20 |
+
name: VDB Tests
|
21 |
+
runs-on: ubuntu-latest
|
22 |
+
strategy:
|
23 |
+
matrix:
|
24 |
+
python-version:
|
25 |
+
- "3.11"
|
26 |
+
- "3.12"
|
27 |
+
|
28 |
+
steps:
|
29 |
+
- name: Checkout code
|
30 |
+
uses: actions/checkout@v4
|
31 |
+
with:
|
32 |
+
fetch-depth: 0
|
33 |
+
persist-credentials: false
|
34 |
+
|
35 |
+
- name: Setup Poetry and Python ${{ matrix.python-version }}
|
36 |
+
uses: ./.github/actions/setup-poetry
|
37 |
+
with:
|
38 |
+
python-version: ${{ matrix.python-version }}
|
39 |
+
poetry-lockfile: api/poetry.lock
|
40 |
+
|
41 |
+
- name: Check Poetry lockfile
|
42 |
+
run: |
|
43 |
+
poetry check -C api --lock
|
44 |
+
poetry show -C api
|
45 |
+
|
46 |
+
- name: Install dependencies
|
47 |
+
run: poetry install -C api --with dev
|
48 |
+
|
49 |
+
- name: Set up dotenvs
|
50 |
+
run: |
|
51 |
+
cp docker/.env.example docker/.env
|
52 |
+
cp docker/middleware.env.example docker/middleware.env
|
53 |
+
|
54 |
+
- name: Expose Service Ports
|
55 |
+
run: sh .github/workflows/expose_service_ports.sh
|
56 |
+
|
57 |
+
- name: Set up Vector Stores (TiDB, Weaviate, Qdrant, PGVector, Milvus, PgVecto-RS, Chroma, MyScale, ElasticSearch, Couchbase)
|
58 |
+
uses: hoverkraft-tech/[email protected]
|
59 |
+
with:
|
60 |
+
compose-file: |
|
61 |
+
docker/docker-compose.yaml
|
62 |
+
services: |
|
63 |
+
weaviate
|
64 |
+
qdrant
|
65 |
+
couchbase-server
|
66 |
+
etcd
|
67 |
+
minio
|
68 |
+
milvus-standalone
|
69 |
+
pgvecto-rs
|
70 |
+
pgvector
|
71 |
+
chroma
|
72 |
+
elasticsearch
|
73 |
+
tidb
|
74 |
+
|
75 |
+
- name: Test Vector Stores
|
76 |
+
run: poetry run -P api bash dev/pytest/pytest_vdb.sh
|
.github/workflows/web-tests.yml
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
name: Web Tests
|
2 |
+
|
3 |
+
on:
|
4 |
+
pull_request:
|
5 |
+
branches:
|
6 |
+
- main
|
7 |
+
paths:
|
8 |
+
- web/**
|
9 |
+
|
10 |
+
concurrency:
|
11 |
+
group: web-tests-${{ github.head_ref || github.run_id }}
|
12 |
+
cancel-in-progress: true
|
13 |
+
|
14 |
+
jobs:
|
15 |
+
test:
|
16 |
+
name: Web Tests
|
17 |
+
runs-on: ubuntu-latest
|
18 |
+
defaults:
|
19 |
+
run:
|
20 |
+
working-directory: ./web
|
21 |
+
|
22 |
+
steps:
|
23 |
+
- name: Checkout code
|
24 |
+
uses: actions/checkout@v4
|
25 |
+
with:
|
26 |
+
fetch-depth: 0
|
27 |
+
persist-credentials: false
|
28 |
+
|
29 |
+
- name: Check changed files
|
30 |
+
id: changed-files
|
31 |
+
uses: tj-actions/changed-files@v45
|
32 |
+
with:
|
33 |
+
files: web/**
|
34 |
+
|
35 |
+
- name: Setup Node.js
|
36 |
+
uses: actions/setup-node@v4
|
37 |
+
if: steps.changed-files.outputs.any_changed == 'true'
|
38 |
+
with:
|
39 |
+
node-version: 20
|
40 |
+
cache: yarn
|
41 |
+
cache-dependency-path: ./web/package.json
|
42 |
+
|
43 |
+
- name: Install dependencies
|
44 |
+
if: steps.changed-files.outputs.any_changed == 'true'
|
45 |
+
run: yarn install --frozen-lockfile
|
46 |
+
|
47 |
+
- name: Run tests
|
48 |
+
if: steps.changed-files.outputs.any_changed == 'true'
|
49 |
+
run: yarn test
|