-
Notifications
You must be signed in to change notification settings - Fork 7
Medplat chatbot #106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Medplat chatbot #106
Conversation
medplat_chatbot_backend/app.py
Outdated
|
|
||
| # OCR using pytesseract | ||
| try: | ||
| pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this supposed to run on windows only?
Otherwise remove the static path.
medplat_chatbot_backend/app.py
Outdated
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| app.run(host="0.0.0.0", debug=True, port=3000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The debug flag should come from the environment.
It should never be hard-coded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Directory name is inconsistent.
No directory named MED_PLAT present.
|
|
||
| # === CONFIG === | ||
| MONGO_URI = os.environ.get("MONGO_URI", "mongodb://localhost:27017/") | ||
| DB_NAME = "medplat" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can move DB_NAME, COLLECTION_NAME & SIMILARITY_THRESHOLD to the environment.
| return jsonify({"fallbacks": simplified_data}) | ||
|
|
||
| if __name__ == "__main__": | ||
| app.run(port=5001, debug=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug should not be true it should come from the environment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move all the css files into the assets folder.
This improves the maintainability of the code base.
| setLoading(true); | ||
| try { | ||
| const res = await axios.delete( | ||
| `http://127.0.0.1:5000/intent_with_examples/${intent}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Api base url should always be placed in the environment file as it gets changed according to the deployment environment.
| setMessage(""); | ||
| setButtons([]); | ||
|
|
||
| const rasaRes = await fetch("http://localhost:3000/send_message", { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API base url should come from the environment.
So that it can be changed in a single place and it takes effect everywhere.
|
|
||
| const fetchClusters = async () => { | ||
| try { | ||
| const res = await axios.get('http://localhost:5001/get_fallbacks'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API base url should come from environment.
| }; | ||
|
|
||
| try { | ||
| const res = await axios.post('http://localhost:5000/add_intent', intentPayload); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API base url should come from environment.
issue #92