neokd / NeoGPT

Chat effortlessly, execute commands, and interpret code with Llama3, Phi3, and more - your local AI assistant. Enjoy seamless interaction while ensuring ultimate privacy
https://neogpt.dev
MIT License
78 stars 64 forks source link

Feature: Timed user input for ui mode #105

Closed savyez closed 10 months ago

savyez commented 10 months ago

Current behavior

The user input is now timed for 5 mins that is, if the user does not give any input for 5 min, the program will close itself. The ui will run again if we hit refresh, but the previous text prompts asked and the answers given will be deleted.

Proposed changes

  1. Updated the requirements.txt file.
  2. Changed the ui.py so that now the last_input_time is tracked using st.session_state. Which helps in comparing it with the timedelta funtion. if datetime.now() - last_input_time > timedelta(minutes=5) the chat input will be closed.

It is better to close the chat_input for ui mode by changing the ui.py rather than terminating the program by changing manager.py. Hence, it is a enhanced solution for issue #93 .

Screenshot (58) After the program is executed (see the bottom right corner for time).

Screenshot (59) After 5-6 mins (see the bottom right corner for time).

Checks

neokd commented 10 months ago

@savyez what about the manager.py? like is there any time input? If we suspend the input for UI the program will be still running in the background or will it terminate fully?

savyez commented 10 months ago

@neokd for CLI there already was a timer in manager.py but for ui, I thinking adding a seperate timer to ui.py was a better choice as we can easily find the timer and also ui takes more time to load than CLI

neokd commented 10 months ago

The CLI one stops if LLM takes more than 2minutes to respond. I was thinking to add something like https://pypi.org/project/pytimedinput/#:~:text=timedInput(),if%20the%20user%20goes%20idle. this into our project for CLI. The UI one looks good ,probably you can add a warning like message at initialisation that bot stops after no interaction received for 5 minutes.

Also check that #104 does not affect the code .

savyez commented 10 months ago

@neokd ig it won't have any conflicts with #104 , we are already importing ui in manager.py. also CLI and ui should have different timings as they both require different set of resources... some of which intersect with each other.... for #104 we can add them similiarly as the persona_list.

neokd commented 10 months ago

Thanks for your contribution @savyez

savyez commented 10 months ago

Thanks for your contribution @savyez

No problem @neokd, happy to contribute more into your repo. Gotta release it ASAP.

savyez commented 10 months ago

also, update the documentation demonstrating --ui.