https://github.com/pepabo/ai-assistant
Interact with GPT-4 in a chat format in a browser.
https://github.com/pepabo/ai-assistant
Last synced: about 1 month ago
JSON representation
Interact with GPT-4 in a chat format in a browser.
- Host: GitHub
- URL: https://github.com/pepabo/ai-assistant
- Owner: pepabo
- License: mit
- Created: 2023-04-14T06:10:27.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-14T23:21:40.000Z (over 1 year ago)
- Last Synced: 2025-04-15T03:05:14.881Z (about 1 month ago)
- Language: Python
- Size: 671 KB
- Stars: 4
- Watchers: 6
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ai-assistant
Interact with GPT-4 in a chat format in a browser.
## Screenshot

## Build & Run locally
```sh
docker build \
--build-arg IMAGE_VERSION='1.0.0' \
--build-arg SERVER_ADDRESS='localhost' \
--build-arg BASE_URL_PATH='' \
-t ai-assistant .
docker run \
--network host \
--env OPENAI_API_KEY="YOUR_API_KEY" \
--rm -ti \
ai-assistant
open http://localhost:8080
```## Build on Google Cloud Build & deploy to Google Cloud Run
IMPORTANT: PLEASE ENSURE THAT ACCESS TO THE SERVICE IS RESTRICTED USING TOOLS LIKE IDENTITY-AWARE PROXY. Failing to do so may allow unauthorized individuals to send requests to OpenAI using your API key.
Put a config file with the following contents.
```yml
# cloud_build_config.yaml
steps:
- name: 'gcr.io/cloud-builders/docker'
args: [
'build',
'--build-arg',
'IMAGE_VERSION=${_IMAGE_VERSION}',
'--build-arg',
'SERVER_ADDRESS=${_SERVER_ADDRESS}',
'--build-arg',
'BASE_URL_PATH=${_BASE_URL_PATH}',
'-t',
'gcr.io/$PROJECT_ID/ai-assistant:${_IMAGE_VERSION}',
'.'
]
substitutions:
_IMAGE_VERSION: 1.0.0
_SERVER_ADDRESS: 0.0.0.0
images: [
'gcr.io/$PROJECT_ID/ai-assistant:${_IMAGE_VERSION}'
]
```and, execute the following commands.
```sh
export BASE_URL_PATH="BASE_URL_PATH"
export GCLOUD_PROJECT="YOUR_GCLOUD_PROJECT"
export GCLOUD_REGION="YOUR_GCLOUD_REGION"
export SERVICE_ACCOUNT="YOUR_SERVICE_ACCOUNT"
gcloud builds submit --config=cloud_build_config.yaml --substitutions=_BASE_URL_PATH=/${BASE_URL_PATH}
gcloud run deploy ai-assistant --image gcr.io/${GCLOUD_PROJECT}/ai-assistant:1.0.0 \
--region ${GCLOUD_REGION} --project ${GCLOUD_PROJECT} --platform managed --memory 1Gi \
--service-account ${SERVICE_ACCOUNT} \
--update-env-vars OPENAI_API_KEY=${OPENAI_API_KEY}
```