it would be great if we made it so that Cody worked without network access in the normal mode, instead of being in a separate offline mode. For example, Cody would start up and start working using the last configured account even before it had logged in again with the server.
Proposed solution in this PR:
store the last used username so that we will be able to get the chat history from the last logged-in user
Test plan
Start Cody from this branch
Open Ollama
Open Chat and ask Cody a question to verify Cody still works when there is an Internet connection
Turn off your Wi-Fi settings
Reload VS Code
Verify you are seeing the connection issue page
Click on Use Cody Offline with Ollama
Verify the sidebar is loaded correctly
Verify you can see the Chat History for your last logged-in user
Open Chat and select an Ollama instruct model
Ask Cody a question and verify you are getting a response back from the Ollama model
Follow up on https://github.com/sourcegraph/cody/pull/4691#pullrequestreview-2143240367
This PR addresses the linked comment by @sqs :
Proposed solution in this PR:
Test plan
Demo
https://github.com/sourcegraph/cody/assets/68532117/c2d1b883-fc7b-442d-8a75-71d121cca92c
Before
As you will be logged in as an unknown user, your chat history from your previous sign in will not be showing up:
After
In Offline mode, we will retrieve your last stored username and endpoint to get the local chat history: