Posts

Reset or level set the routine

Image
 I have removed some excess experimental code in the FLASK_APP.py code. Initially, code behind buttons was added to experiment with tech. Code like adding records to the MySQL DB was in the python routine TwoIndex. I got that syntax to work and so saving it for future reference was in order. The routines ONEINDEX, TWOINDEX, THREEINDEX were renamed to match what was is in the LAYOUT.HTML and LAYOUT2.html files.  Next I want to add to the questions and login code from CHATGPT to save the IP of the machine. I recognize this may be the incorrect as a design as proxy's and other Security features may make it useless - but that is the question. I will have to modify the SQL and the MySQL DB to have a field to use and populate with the IP. Below is the CHATGPT output:

Got a little help from a new Friend - CHATGPT

Image
 I have been tinkering around with OPENAI's CHATGPT. I asked help to remedy the issue of the small box to ask questions of CHATGPT in my PythonAnywhere experiment.  Below is a image of one exchange - it takes me longer to formulate the question than CHATGPT to start to generate an answer.  I would try a response - it might not work, so I would rephrase the context or the question and ask again. Specifically it was recommending using text area but I had difficulty seeing how to return the value in the box to be able to submit to CHATGPT. I finally got it to work and have CHATGPT return a answer from the TEXTAREA html construct. ChatGPT return text formatted HTML. In other words I was getting the HTML command as visible text.  So asked ChatGPT - " How to display HTML in flask {{answer}} " It provide a solution I was unaware of - the "SAFE" command in FLASK Here is where I implemented it in ANSWER.HTML of my PythonAnywhere effort.

Coding paused due and restored

 A couple of weeks ago I started getting an "Internal Server Error" when I attempted to post a question.  The error log - https://www.pythonanywhere.com/user/BenConnolly/files/var/log/benconnolly.pythonanywhere.com.error.log  reported the following: 2023-04-09 12:11:19,223: error_code=None error_message='You exceeded your current quota, please check your plan and billing details.' error_param=None error_type=insufficient_quota message='OpenAI API error received' stream_error=False I debated with myself if I should sign up for the API Key subscription. Over the weekend the CBS show called 60 Minutes dedicated 2 segment on Artificial Intellience.  This was an inspiration -  I signed up for a pay as you go plan yesterday. 

Created a back up - on my Q Drive

 I've downloaded the relevant filed to "Q:\Python Training\PythonAnywhere 2023-03-04 - BenConnolly" from "https://www.pythonanywhere.com/user/BenConnolly/files/home/BenConnolly" I've created a  VDP001_IPYTHON_Notebook for additional experimentation Next coding objectives:      To code a way to present the content of Q & A from DB.     To code or develop a way to send an email - without a cost. I also need to resolve an "Internal Server error" when running from Visual Studio. I will WINMERGE compare     "Q :\... Training\FlaskWebProject3" in Visual Studio against the  "Q:\..._Pythonanywhere\VDPFlask_Pythonanywhere"  to identify a source for the Server error

Now saving Questions and Answer from Chatgpt

 Two new things of value have been added last night. First is that I've created a separate "Module" or stand-alone file for specialized functions. In this instance the new code that was added takes the question and answer from ChatGPT and adds a record into a new MySQL table. In due course modifications to table will be needed.  I will be adding similar logic for the sign-up logic.  I have to decide if there is a need to have the debate functionality work online or off-line

Set up a link to ask CHATGPT a question

Image
 Tonight I added a link and 2 HTML pages tonight. From the Intro page a user can click a link to a page to ask a question of CHATGPT and get a response. Here is the question page: When you enter a question - and then click submit you will be sent to the answer page presentation: Any question can be asked theoretically. A next steps are to save the question and the answer into the DB. I will need similar processing for the Sign-in processing  

Issues with PyQT5, import class and Flask

Image
 Attempting to get QTDesigner files to work from the web. Q:\Python Training\FlaskWebProject2 - this is the current working Visual Studio version that I'm looking to fit a sample python editor from QTDesigner - Q:\Python Training\xxxx\sample_editor. It uses PyQT5 and appears to be a non-web python app. Having errors getting a "Class" in the FlaskWebProject2 to work - even a very simple example from a web article: " https://favtutor.com/blogs/import-class-from-another-file-python#:~:text=Python%20provides%20us%20with%20various,functions%20using%20the%20import%20statements. " Will check out - "https://flask.palletsprojects.com/en/2.2.x/views/"