-
-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
🔨 chore: Refresh token when change historyCount
#3094
base: main
Are you sure you want to change the base?
Conversation
@sxjeru is attempting to deploy a commit to the LobeHub Pro Team on Vercel. A member of the Team first needs to authorize it. |
👍 @sxjeru Thank you for raising your pull request and contributing to our Community |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3094 +/- ##
==========================================
- Coverage 94.17% 94.17% -0.01%
==========================================
Files 394 394
Lines 24701 24700 -1
Branches 2806 2694 -112
==========================================
- Hits 23262 23260 -2
- Misses 1439 1440 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
const chatsMessageString = (s: ChatStore): string => { | ||
const chats = currentChatsWithHistoryConfig(s); | ||
const chatsMessageString = (s: ChatStore, config: LobeAgentChatConfig): string => { | ||
const chats = currentChatsWithHistoryConfig(s, config); | ||
return chats.map((m) => m.content).join(''); |
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.
核心问题还是message 的长度响应来自 chats
而不是 config ,确保响应式的正确做法应该是将 chats 作为入参,即
const chatsMessageString = (chats: ChatMessage[]) =>(s: ChatStore): string =>
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.
可以先试试我下面的回复写法是否OK,如果下面的写法能确保响应式,也可以
@@ -22,9 +22,10 @@ const Token = memo(() => { | |||
const { t } = useTranslation(['chat', 'components']); | |||
const theme = useTheme(); | |||
|
|||
const config = agentSelectors.currentAgentChatConfig(useAgentStore.getState()); |
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.
另外这个写法也是有问题的。
useAgentStore.getState()
这个不是一个响应式的写法,取出来的值是fixed的,要响应式,得改成
const config = useAgentStore(agentSelectors.currentAgentChatConfig)
💻 变更类型 | Change Type
🔀 变更说明 | Description of Change
#2933 重新实现。
存在一个问题,当历史消息数设置为大于现有消息数后,不论如何修改设置,token 均不会刷新。
准确来说是下面的 config 状态不再刷新。直到切换话题或刷新网页后恢复。
不清楚是什么问题。
lobe-chat/src/features/ChatInput/ActionBar/Token/TokenTag.tsx
Line 25 in 75b9fbe
📝 补充信息 | Additional Information