-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor chat conversation component to improve modularity and readab… (
#526) * Refactor chat conversation component to improve modularity and readability. * Remove deprecated `conversation.vue` and update import path in `index.vue` * Refactor import paths in Conversation.vue and MessageList.vue to use absolute paths for consistency. * Refactor Conversation component to accept sessionUuid as prop instead of using route params. * Refactor chat helper functions and update related store methods.
- Loading branch information
Showing
5 changed files
with
670 additions
and
645 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,14 @@ | ||
const default_chat_data: Chat.ChatState = { | ||
active: null, | ||
history: [], | ||
chat: {}, | ||
active: null, // uuid | null | ||
history: [], // Chat.Session[] | ||
chat: {}, // { [key: string]: Chat.ChatMessage[] } | ||
} | ||
|
||
export function getLocalState(): Chat.ChatState { | ||
return default_chat_data | ||
} | ||
|
||
export function check_chat(chat: Chat.ChatState['chat'], need_length = true) { | ||
export function getChatKeys(chat: Chat.ChatState['chat'], includeLength = true) { | ||
const keys = Object.keys(chat) | ||
const data: [Array<string>, number?] = [keys] | ||
if (need_length) { | ||
const keys_length = keys.length | ||
data.push(keys_length) | ||
} | ||
return data | ||
return includeLength ? [keys, keys.length] as const : [keys] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.