Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
20001LastOrder authored Jun 26, 2023
2 parents 4ab30a6 + a565dd5 commit a019565
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion apps/slackbot/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RUN pip install --no-cache-dir -r requirements.txt
COPY . .

# Expose the port that the Flask app will listen on
EXPOSE 3000
EXPOSE 80

# Run the Flask app
CMD ["python", "bolt_app.py"]
11 changes: 9 additions & 2 deletions apps/slackbot/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from langchain.document_loaders import UnstructuredPDFLoader
from langchain.indexes import VectorstoreIndexCreator
from langchain.chains import RetrievalQA
from flask_cors import CORS

import shutil
import atexit
Expand All @@ -32,6 +33,8 @@

# This `app` represents your existing Flask app
app = Flask(__name__)
CORS(app)

greetings = ["hi", "hello", "hello there", "hey"]


Expand All @@ -54,10 +57,14 @@
###########################################################################

# instantiating slack client
slack_client = WebClient(SLACK_OAUTH_TOKEN)
slack_client = WebClient(SLACK_OAUTH_TOKEN)
os.environ['OPENAI_API_KEY'] = OPENAI_KEY


@app.route('/hello')
def hello():
return "hello from slackbot app"

# An example of one of your Flask app's routes
@app.route("/")
def event_hook(request):
Expand Down Expand Up @@ -190,4 +197,4 @@ def createIndex(pdf_folder_path):
# qa = createLangchainQA(vectorstore)

chain = createIndex("files")
app.run(port=3000)
app.run(host="0.0.0.0", port="80")
3 changes: 2 additions & 1 deletion apps/slackbot/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ openai
chromadb
tiktoken
slack_bolt
pinecone-client
pinecone-client
Flask-Cors==3.0.10
5 changes: 4 additions & 1 deletion apps/slackbot/buildspec.prod.yml → buildspec.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ phases:
- REPOSITORY_URI=387065515315.dkr.ecr.us-east-1.amazonaws.com/ai/slackbot
- COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
- IMAGE_TAG=build-$(echo $CODEBUILD_BUILD_ID | awk -F":" '{print $2}')
- aws s3 sync s3://ai-config-one/slackbot ./
- mv env-prod.properties production.env
- cp production.env ./apps/slackbot/.env
build:
commands:
- echo Build started on `date`
- echo Building the Docker image...
- docker login --username aiscience --password 2E9nUhgCB5smmQsa
- docker build --cache-from $REPOSITORY_URI:latest -t $REPOSITORY_URI:latest .
- docker build --cache-from $REPOSITORY_URI:latest -t $REPOSITORY_URI:latest ./apps/slackbot
- docker tag $REPOSITORY_URI:latest $REPOSITORY_URI:$IMAGE_TAG

post_build:
Expand Down

0 comments on commit a019565

Please sign in to comment.