-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix: The page cannot continue streaming response when changing the conversation name in the conversation reply #2480
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -75,7 +75,7 @@ const submit = async (formEl: FormInstance | undefined) => { | |
| await formEl.validate((valid) => { | ||
| if (valid) { | ||
| log.asyncPutChatClientLog(applicationId.value, chatId.value, form.value, loading).then(() => { | ||
| emit('refresh') | ||
| emit('refresh', chatId.value, form.value.abstract) | ||
| dialogVisible.value = false | ||
| }) | ||
| } | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are no significant issues with the code. Here are a couple of minor optimizations:
Here is the revised code: const submit = async (formEl: FormInstance | undefined) => {
await formEl.validate((valid) => {
if (valid) {
loading.value = true; // Set loading indicator to true
try {
await log.asyncPutChatClientLog(applicationId.value, chatId.value, form.value);
} catch (error) {
console.error("Failed to update chat client log", error); // Log any errors
}
emit('refresh', chatId.value);
dialogVisible.value = false;
}
loading.value = false; // Set loading indicator to false
});
};With these changes, the code becomes more robust and handles potential errors gracefully. However, it remains otherwise unchanged from your original version. |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -232,8 +232,11 @@ function mouseenter(row: any) { | |
| function editLogTitle(row: any) { | ||
| EditTitleDialogRef.value.open(row, applicationDetail.value.id) | ||
| } | ||
| function refreshFieldTitle() { | ||
| getChatLog(applicationDetail.value.id) | ||
| function refreshFieldTitle(chatId: string, abstract: string) { | ||
| const find = chatLogData.value.find((item: any) => item.id == chatId) | ||
| if (find) { | ||
| find.abstract = abstract | ||
| } | ||
| } | ||
| function deleteLog(row: any) { | ||
| log.asyncDelChatClientLog(applicationDetail.value.id, row.id, left_loading).then(() => { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code looks mostly correct, but here are some minor suggestions and comments for improvement:
Here’s an updated version of the code incorporating these suggestions: @@ -232,8 +232,10 @@ function mouseenter(row: any) {
}
function editLogTitle(row: any) {
EditTitleDialogRef.value.open(row, applicationDetail.value?.id ?? undefined);
}
-function refreshFieldTitle() {
- getChatLog(applicationDetail.value.id);
+function refreshFieldTitle(chatId: string | null = null, abstract?: string) {
+ if (chatId !== null && !!abstract) {
+ const find = chatLogData.value.find(item => item.id === chatId);
+ if (find) {
+ find.abstract = abstract;
+ }
+ }
}
function deleteLog(row: any) {
log.asyncDelChatClientLog(
applicationDetail.value?.id ?? undefined,
row.id,
left_loading
).then(() => {By applying these changes, the code becomes more robust, follows consistent naming conventions, reduces redundancy, and improves readability. |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code does not appear to have obvious syntax errors or logical inconsistencies. However, there is room for optimization and improvements:
findmethod can be replaced with a more direct approach using[].filter, which is generally faster:Ensure that
chatLogData.valuecontains data before attempting to filter items. Adding type checking might further secure the code.If
objhas properties other thanabstractyou need to decide what to do about those properties since they are being discarded when updating theitem.These changes aim to make the code cleaner without affecting functionality significantly.