-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Code refactoring #132
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
Code refactoring #132
Conversation
Unless, if we tries to access the client side page from http protocol, crypto.randomUUID() isn't available.
Remove crypto.randomUUID() from client side
Things to be done:
|
brief of new state structure: here we use recoil to handle global state. please refer to the docs of the usage. (typically, similar to useState) conversation.jsatom conversationThe current conversation, can be an object or null (null means client need to fetch from server) If a new chat is created, conversation is also an object. with conversationId = 'new' When sending new message, {model, chatGptLabel, promptPrefix} is decided by this atom To set particialy, use
atom messagesThe list of current messages of the conversation, must be an array or null
selector messagesTreea readonly selector, from atom messages. same as the old version. to use it:
atom latestMessageThe latest message of the conversation that is showing. useConversationA custom hook, provide { newConversation } newConversation: a function that will create new conversation and do all clean up work.
if model == null, getDefaultModel will be called, to set the model as the default version. (firstly check localstorage, or select the first one) Use this to create new chat, DONT set conversation and messages and latestmessage by hand, it's dirty. conversations.jsHere doesn't storage the conversation list. just a refreshConversationsHint to ask refresh conversation. atom refreshConversationsHintas before hook useConversationsprovides a function { refreshConversations }, to ask for refresh conversation list. eg:
models.jsSave available models here atom customGPTModelsa array of customGPTModels. can be filled by server api. must follow this:
You might not need this, cc availableModels selector models:readonly, equals to default models + customGPTModels You might not need this, cc availableModels atom modelsFilter:an object of available models. in this form:
selector availableModels:readonly, from models. filtered by modelsFilter You might love this submission.jsall things related to a submission. atom submissioncurrent submission object. send a new object to this will submit a new message. atom isSubmittingas the name showing user.jsatom usercurrent user. |
closed, to catch up to the latest version, another branch is working on this. |
replaced by #140 code has been updated to the latest version |
no need to setup page in this repo
This PR is created to track the progress of refactoring of the client.
This PR is based on Commit 90dda84.
Here is the summary list of changes:
ui/
andInput/
/api/convos/:conversationId
to retrive a conversation