设置运行会话ID的代码优化
This commit is contained in:
@@ -612,11 +612,15 @@ export function TabProvider({ children }: TabProviderProps) {
|
|||||||
|
|
||||||
const setTabRuntimeConversationId = useCallback(
|
const setTabRuntimeConversationId = useCallback(
|
||||||
(tabId: string, runtimeConversationId: number) => {
|
(tabId: string, runtimeConversationId: number) => {
|
||||||
setTabs((prev) =>
|
setTabs((prev) => {
|
||||||
prev.map((tab) =>
|
const target = prev.find((tab) => tab.id === tabId)
|
||||||
|
if (!target || target.runtimeConversationId === runtimeConversationId) {
|
||||||
|
return prev
|
||||||
|
}
|
||||||
|
return prev.map((tab) =>
|
||||||
tab.id === tabId ? { ...tab, runtimeConversationId } : tab
|
tab.id === tabId ? { ...tab, runtimeConversationId } : tab
|
||||||
)
|
)
|
||||||
)
|
})
|
||||||
},
|
},
|
||||||
[]
|
[]
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user