Skip to content

Commit

Permalink
Type Safety (Issue front end lmao) (ChatGPTNextWeb#203)
Browse files Browse the repository at this point in the history
* Chore [Chat] [Client Api] Type Safety

- [+] chore(chat.ts): change 'var' to 'let' for 'api' variable assignment
- [+] refactor(chat.ts): improve comment explaining the reason for using 'let' instead of 'var'

* Fix [Chat] [Client Api] change 'var' to 'let' for variable 'api'

- [+] fix(chat.ts): change 'var' to 'let' for variable 'api' to allow conditional reassignment
- [+] fix(chat.ts): update session messages with new bot and user messages

* Chore [Chat] Update Session Messages

- [+] chore(chat.ts): update session messages with new bot message in useChatStore

* Fix [Chat] Concat

- [+] fix(chat.ts): remove unnecessary code for updating session messages
- [+] feat(chat.ts): add support for updating session messages
  • Loading branch information
H0llyW00dzZ authored Dec 25, 2023
1 parent f6a6607 commit 9d15b3f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/store/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,9 @@ export const useChatStore = createPersistStore(
]);
});

var api: ClientApi;
// Changed 'var' to 'let' since 'api' is reassigned conditionally
// Note: keep type safety by using 'let' instead of 'var', this not a javascript lmao
let api: ClientApi;
if (modelConfig.model === "gemini-pro") {
api = new ClientApi(ModelProvider.GeminiPro);
} else {
Expand Down Expand Up @@ -491,7 +493,9 @@ export const useChatStore = createPersistStore(
const session = get().currentSession();
const modelConfig = session.mask.modelConfig;

var api: ClientApi;
// Changed 'var' to 'let' since 'api' is reassigned conditionally
// Note: keep type safety by using 'let' instead of 'var', this not a javascript lmao
let api: ClientApi;
if (modelConfig.model === "gemini-pro") {
api = new ClientApi(ModelProvider.GeminiPro);
} else {
Expand Down

0 comments on commit 9d15b3f

Please sign in to comment.