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.
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.
The debug flag should come from the environment.
It should never be hard-coded.
There was a problem hiding this comment.
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.
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.
Debug should not be true it should come from the environment.
There was a problem hiding this comment.
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.
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.
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.
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.
API base url should come from environment.
issue #92