Skip to content
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

Stop adding messages to backend history via frontend 🛠🛠 #828

Open
pmarsh-scottlogic opened this issue Feb 6, 2024 · 1 comment · Fixed by #873, #874, #875, #883 or #884
Open

Stop adding messages to backend history via frontend 🛠🛠 #828

pmarsh-scottlogic opened this issue Feb 6, 2024 · 1 comment · Fixed by #873, #874, #875, #883 or #884
Assignees
Labels
backend Requires work on the backend frontend Requires work on the frontend refactor Improve code quality

Comments

@pmarsh-scottlogic
Copy link
Contributor

pmarsh-scottlogic commented Feb 6, 2024

I note that there is an endpoint to add a message to the backend's chat history. We only every do this as a direct result of something that happened in the backend. Therefore this endpoint and all its associated network calls don't need to exist.

🔧 Remove the endpoint /openai/addHistory and add messages to history in the backend instead. Delete the frontend methods that use this endpoint, including addInfoMessageToChatHistory, addResetMessage, addInfoMessage, and other methods tat only exist to add stuff to backend history.

The user actions that would result in a change in chat history and thus a superfluous API call are:

ACCEPTANCE CRITERIA

The following acceptance criteria boil down to doing the above listed actions, checking that the actions work and the info messages are added, and there is only one network call

WHEN user wins a level
THEN level completion message appears as normal in chat
AND only one network call of type fetch

WHEN user sends a message that triggers a defence (e.g. configure character limit to be super small, then send a long message)
THEN the defence triggered message appears as normal in chat
AND only one network call of type fetch

WHEN user sends a message that alerts a defence (e.g. configure a character limit to be small, then disable the defence again and send a long message)
THEN the defence alerted message appears as normal in chat
AND only one network call of type fetch

WHEN user configures a defence (i.e. changes the character limit)
THEN the defence configured message appears as normal in chat
AND only one network call of type fetch

WHEN user toggles a defence on or off
THEN the defence enabled / disabled message appears as normal in chat
AND only one network call of type fetch

WHEN user changes the chat model (under model configuration)
THEN the model changed message appears as normal in chat
AND only one network call of type fetch

WHEN user changes a configuration of the chat model (under model configuration)
THEN the model configured message appears as normal in chat
AND only one network call of type fetch


Here's how you quickly find out what api calls are being made that are fetch type. Note that the CombinedFonts call is of type xhr, therefore we ignore it.

image

@pmarsh-scottlogic pmarsh-scottlogic changed the title Stop adding messages to backend history via frontend. Stop adding messages to backend history via frontend 🛠 Feb 6, 2024
@pmarsh-scottlogic pmarsh-scottlogic changed the title Stop adding messages to backend history via frontend 🛠 Stop adding messages to backend history via frontend 🛠🛠 Feb 6, 2024
@pmarsh-scottlogic pmarsh-scottlogic added frontend Requires work on the frontend backend Requires work on the backend refactor Improve code quality labels Feb 6, 2024
@pmarsh-scottlogic pmarsh-scottlogic self-assigned this Mar 21, 2024
@pmarsh-scottlogic pmarsh-scottlogic linked a pull request Mar 28, 2024 that will close this issue
3 tasks
@pmarsh-scottlogic pmarsh-scottlogic linked a pull request Mar 28, 2024 that will close this issue
3 tasks
@chriswilty
Copy link
Member

chriswilty commented Apr 23, 2024

Three usages remaining:

  • MainComponent, when a defence was reset by the user
  • ChatBox, when a defence was triggered or alerted during a chat

Once these have been tackled, the service call can be removed from frontend and backend code.

@chriswilty chriswilty reopened this Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment