Skip to content

Commit

Permalink
fix: 历史记录被全部改为同一个模型 (#1717)
Browse files Browse the repository at this point in the history
  • Loading branch information
song-xiao-lin authored Jun 7, 2024
1 parent d80ee5f commit afdfad0
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions app/renderer/src/main/src/components/yakChat/chatCS.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2955,8 +2955,8 @@ export const PluginAIComponent: React.FC<PluginAIComponentProps> = (props) => {
// 更新单独展示项
setPluginAIItem((lastItem) =>
lastItem.map((item, index) => {
item.info.extra = extra || {}
if (lastItem.length === index + 1) {
item.info.extra = extra || {}
item.info.content = content
item.time = formatDate(+new Date())
return item
Expand All @@ -2967,8 +2967,8 @@ export const PluginAIComponent: React.FC<PluginAIComponentProps> = (props) => {
// 更新历史展示
setPluginAIList(
newPluginAIList.map((item, index) => {
item.info.extra = extra || {}
if (newPluginAIList.length === index + 1) {
item.info.extra = extra || {}
item.info.content = content
item.time = formatDate(+new Date())
return item
Expand All @@ -2983,14 +2983,9 @@ export const PluginAIComponent: React.FC<PluginAIComponentProps> = (props) => {
const updateExtraInfo = useMemoizedFn((extra) => {
setPluginAIItem((lastItem) =>
lastItem.map((item) => {
item.info.extra = extra || {}
return item
})
)
const newPluginAIList: PluginAiItem[] = JSON.parse(JSON.stringify(pluginAIList))
setPluginAIList(
newPluginAIList.map((item) => {
item.info.extra = extra || {}
if (!item.info.extra || JSON.stringify(item.info.extra) === "{}") {
item.info.extra = extra || {}
}
return item
})
)
Expand Down Expand Up @@ -3061,7 +3056,7 @@ export const PluginAIComponent: React.FC<PluginAIComponentProps> = (props) => {

// 执行
const onStartExecute = useMemoizedFn((data: CodecParamsProps) => {
const {text, scriptName, isAiPlugin,code} = data
const {text, scriptName, isAiPlugin, code} = data
const executeParams = {
Input: text || "",
PluginName: scriptName,
Expand Down

0 comments on commit afdfad0

Please sign in to comment.