Skip to content

Commit bff6dc2

Browse files
committed
CodeurZEBS First commit ict chatbot for EXAM
0 parents  commit bff6dc2

File tree

115 files changed

+17017
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+17017
-0
lines changed

.devcontainer/devcontainer.json

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"name": "Azure Developer CLI",
3+
"image": "mcr.microsoft.com/devcontainers/python:3.10",
4+
"features": {
5+
"ghcr.io/devcontainers/features/node:1": {
6+
"version": "16",
7+
"nodeGypDependencies": false
8+
},
9+
"ghcr.io/devcontainers/features/azure-cli:1.0.8": {},
10+
"ghcr.io/azure/azure-dev/azd:latest": {}
11+
},
12+
"customizations": {
13+
"vscode": {
14+
"extensions": [
15+
"ms-azuretools.azure-dev",
16+
"ms-azuretools.vscode-bicep",
17+
"ms-python.python"
18+
]
19+
},
20+
"codespaces": {
21+
"openFiles": [
22+
"README.md"
23+
]
24+
}
25+
},
26+
"forwardPorts": [
27+
5000
28+
],
29+
"remoteUser": "vscode",
30+
"hostRequirements": {
31+
"memory": "8gb"
32+
}
33+
}

.env.sample

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
AZURE_SEARCH_SERVICE=
2+
AZURE_SEARCH_INDEX=
3+
AZURE_SEARCH_KEY=
4+
AZURE_SEARCH_USE_SEMANTIC_SEARCH=False
5+
AZURE_SEARCH_SEMANTIC_SEARCH_CONFIG=default
6+
AZURE_SEARCH_INDEX_IS_PRECHUNKED=False
7+
AZURE_SEARCH_TOP_K=5
8+
AZURE_SEARCH_ENABLE_IN_DOMAIN=False
9+
AZURE_SEARCH_CONTENT_COLUMNS=
10+
AZURE_SEARCH_FILENAME_COLUMN=
11+
AZURE_SEARCH_TITLE_COLUMN=
12+
AZURE_SEARCH_URL_COLUMN=
13+
AZURE_SEARCH_VECTOR_COLUMNS=
14+
AZURE_SEARCH_QUERY_TYPE=simple
15+
AZURE_SEARCH_PERMITTED_GROUPS_COLUMN=
16+
AZURE_SEARCH_STRICTNESS=3
17+
AZURE_OPENAI_RESOURCE=
18+
AZURE_OPENAI_MODEL=
19+
AZURE_OPENAI_KEY=
20+
AZURE_OPENAI_MODEL_NAME=gpt-35-turbo-16k
21+
AZURE_OPENAI_TEMPERATURE=0
22+
AZURE_OPENAI_TOP_P=1.0
23+
AZURE_OPENAI_MAX_TOKENS=1000
24+
AZURE_OPENAI_STOP_SEQUENCE=
25+
AZURE_OPENAI_SYSTEM_MESSAGE=You are an AI assistant that helps people find information.
26+
AZURE_OPENAI_PREVIEW_API_VERSION=2023-06-01-preview
27+
AZURE_OPENAI_STREAM=True
28+
AZURE_OPENAI_ENDPOINT=
29+
AZURE_OPENAI_EMBEDDING_NAME=
30+
AZURE_COSMOSDB_ACCOUNT=
31+
AZURE_COSMOSDB_DATABASE=
32+
AZURE_COSMOSDB_CONVERSATIONS_CONTAINER=
33+
AZURE_COSMOSDB_ACCOUNT_KEY=
34+
AZURE_COSMOSDB_MONGO_VCORE_DATABASE=
35+
AZURE_COSMOSDB_MONGO_VCORE_CONNECTION_STRING=
36+
AZURE_COSMOSDB_MONGO_VCORE_CONTAINER=
37+
AZURE_COSMOSDB_MONGO_VCORE_INDEX=
38+
AZURE_COSMOSDB_MONGO_VCORE_CONTENT_COLUMNS=
39+
AZURE_COSMOSDB_MONGO_VCORE_VECTOR_COLUMNS=
40+
AZURE_COSMOSDB_ENABLE_FEEDBACK=False
41+
AUTH_ENABLED=False

.gitattributes

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
* text=auto eol=lf
2+
*.{cmd,[cC][mM][dD]} text eol=crlf
3+
*.{bat,[bB][aA][tT]} text eol=crlf

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.venv
2+
frontend/node_modules
3+
.env
4+
# static
5+
.azure/
6+
__pycache__/
7+
.ipynb_checkpoints/

.vscode/launch.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Python: Sample UI Backend",
9+
"type": "python",
10+
"request": "launch",
11+
"module": "flask",
12+
"envFile": "${workspaceFolder}/.env",
13+
"args": ["run", "--no-debugger", "--no-reload", "-p 5000"],
14+
"justMyCode": true
15+
}
16+
]
17+
}

CODE_OF_CONDUCT.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Microsoft Open Source Code of Conduct
2+
3+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
4+
5+
Resources:
6+
7+
- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
8+
- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
9+
- Contact [[email protected]](mailto:[email protected]) with questions or concerns

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) Microsoft Corporation.
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

TEST_CASE_FLOWS.md

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Introduction
2+
Below are some flows to follow to make sure code changes are tested effectivly and efficiently.
3+
The goal is to make sure that this is repeatable and can be done by anyone to avoid regressions.
4+
5+
## Test Case Flows
6+
- with data, streaming
7+
- with data, non streaming
8+
- without data, streaming
9+
- without data, non streaming
10+
- All of the above with and without chat history
11+
12+
### With Data, Streaming
13+
The following environment variables are required to run this test case:
14+
15+
`AZURE_SEARCH_SERVICE`\
16+
`AZURE_SEARCH_INDEX`\
17+
`AZURE_SEARCH_KEY`
18+
19+
`AZURE_OPENAI_STREAM` should be set to `true`
20+
21+
### With Data, Streaming, Chat History
22+
Keep the same environment variables as above, but add the following:
23+
24+
`AZURE_COSMOSDB_DATABASE`\
25+
`AZURE_COSMOSDB_ACCOUNT`\
26+
`AZURE_COSMOSDB_CONVERSATIONS_CONTAINER`\
27+
`AZURE_COSMOSDB_ACCOUNT_KEY`
28+
29+
### With Data, Nonstreaming
30+
The following environment variables are required to run this test case:
31+
`AZURE_SEARCH_SERVICE`\
32+
`AZURE_SEARCH_INDEX`\
33+
`AZURE_SEARCH_KEY`
34+
35+
`AZURE_OPENAI_STREAM` should be set to `false`
36+
37+
### With Data, Nonstreaming, Chat History
38+
Keep the same environment variables as above, but add the following:
39+
40+
`AZURE_COSMOSDB_DATABASE`\
41+
`AZURE_COSMOSDB_ACCOUNT`\
42+
`AZURE_COSMOSDB_CONVERSATIONS_CONTAINER`\
43+
`AZURE_COSMOSDB_ACCOUNT_KEY`
44+
45+
### Without Data, Streaming
46+
The following environment variables should **not** be set:
47+
48+
`AZURE_SEARCH_SERVICE`\
49+
`AZURE_SEARCH_INDEX`\
50+
`AZURE_SEARCH_KEY`
51+
52+
`AZURE_OPENAI_STREAM` should be set to `true`
53+
54+
### Without Data, Streaming, Chat History
55+
Keep the same environment variables as above, but add the following:
56+
57+
`AZURE_COSMOSDB_DATABASE`\
58+
`AZURE_COSMOSDB_ACCOUNT`\
59+
`AZURE_COSMOSDB_CONVERSATIONS_CONTAINER`\
60+
`AZURE_COSMOSDB_ACCOUNT_KEY`
61+
62+
### Without Data, Nonstreaming
63+
The following environment variables should **not** be set:
64+
65+
`AZURE_SEARCH_SERVICE`\
66+
`AZURE_SEARCH_INDEX`\
67+
`AZURE_SEARCH_KEY`
68+
69+
`AZURE_OPENAI_STREAM` should be set to `false`
70+
71+
### Without Data, Nonstreaming, Chat History
72+
Keep the same environment variables as above, but add the following:
73+
74+
`AZURE_COSMOSDB_DATABASE`\
75+
`AZURE_COSMOSDB_ACCOUNT`\
76+
`AZURE_COSMOSDB_CONVERSATIONS_CONTAINER`\
77+
`AZURE_COSMOSDB_ACCOUNT_KEY`

WebApp.Dockerfile

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
FROM node:20-alpine AS frontend
2+
RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app
3+
4+
WORKDIR /home/node/app
5+
COPY ./frontend/package*.json ./
6+
USER node
7+
RUN npm ci
8+
COPY --chown=node:node ./frontend/ ./frontend
9+
COPY --chown=node:node ./static/ ./static
10+
WORKDIR /home/node/app/frontend
11+
RUN npm run build
12+
13+
FROM python:3.11-alpine
14+
RUN apk add --no-cache --virtual .build-deps \
15+
build-base \
16+
libffi-dev \
17+
openssl-dev \
18+
curl \
19+
&& apk add --no-cache \
20+
libpq \
21+
&& pip install --no-cache-dir uwsgi
22+
23+
COPY requirements.txt /usr/src/app/
24+
RUN pip install --no-cache-dir -r /usr/src/app/requirements.txt \
25+
&& rm -rf /root/.cache
26+
27+
COPY . /usr/src/app/
28+
COPY --from=frontend /home/node/app/static /usr/src/app/static/
29+
WORKDIR /usr/src/app
30+
ENV UWSGI_PROCESSES=2
31+
ENV UWSGI_THREADS=1
32+
EXPOSE 80
33+
CMD uwsgi --processes $UWSGI_PROCESSES --threads $UWSGI_THREADS --http :80 --wsgi-file app.py --callable app -b 32768

WebApp.dockerignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.venv
2+
.env
3+
WebApp.Dockerfile
4+
WebApp.dockerignore
5+
frontend/node_modules

0 commit comments

Comments
 (0)