Skip to content
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

fix: custom chat title #534

Merged
merged 3 commits into from
Dec 3, 2023
Merged

fix: custom chat title #534

merged 3 commits into from
Dec 3, 2023

Conversation

nongmo677
Copy link
Contributor

@nongmo677 nongmo677 commented Dec 1, 2023

Fix: Update Custom Chat Title Based on chatId

Copy link

cla-assistant bot commented Dec 1, 2023

CLA assistant check
All committers have signed the CLA.

Copy link

sweep-ai bot commented Dec 1, 2023

Apply Sweep Rules to your PR?

  • Apply: All new business logic should have corresponding unit tests.
  • Apply: Refactor large functions to be more modular.
  • Apply: Add docstrings to all functions and file headers.

...(customTitle ? { customTitle } : {}),
...(top ? { top } : { top: null })
});
},{ new: true });
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不能使用new

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

确实,当时为了调试输出用的,是删掉new就通过了?
目前是使用findByIdAndUpdate没正确更新titile,刷新就会重新读取title,使用findOneAndUpdate({ chatId: chatId }这样的方式也不正确吗?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

findOneAndUpdate是正确的,因为chatId是个独立的属性。但是不需要后面的new true,否则有可能创建脏数据。

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

确实,当时为了调试输出用的,是删掉new就通过了?
目前是使用findByIdAndUpdate没正确更新titile,刷新就会重新读取title,使用findOneAndUpdate({ chatId: chatId }这样的方式也不正确吗?

可以修改下再push下

@c121914yu c121914yu merged commit 7fc05af into labring:main Dec 3, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants