From 0ef098b73f4eb9e121aa7d51ca7106fe14b76934 Mon Sep 17 00:00:00 2001 From: jiangxujin Date: Thu, 21 Aug 2025 19:52:05 +0800 Subject: [PATCH] fix: conversation default id --- .../biz-workflow/src/conversation/constants/index.ts | 3 --- .../src/conversation/hooks/use-delete-chat/index.tsx | 6 +++--- .../src/conversation/static-chat-list/index.tsx | 6 ++---- .../src/components/conversation-select/conversations.tsx | 5 ++--- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/frontend/packages/project-ide/biz-workflow/src/conversation/constants/index.ts b/frontend/packages/project-ide/biz-workflow/src/conversation/constants/index.ts index b3b698f7b9..c176a4c286 100644 --- a/frontend/packages/project-ide/biz-workflow/src/conversation/constants/index.ts +++ b/frontend/packages/project-ide/biz-workflow/src/conversation/constants/index.ts @@ -16,9 +16,6 @@ import { I18n } from '@coze-arch/i18n'; -// Default session unique_id -export const DEFAULT_UNIQUE_ID = '0'; - export const DEFAULT_CONVERSATION_NAME = 'Default'; export const MAX_LIMIT = 1000; diff --git a/frontend/packages/project-ide/biz-workflow/src/conversation/hooks/use-delete-chat/index.tsx b/frontend/packages/project-ide/biz-workflow/src/conversation/hooks/use-delete-chat/index.tsx index 48d21201f8..6836d58e1f 100644 --- a/frontend/packages/project-ide/biz-workflow/src/conversation/hooks/use-delete-chat/index.tsx +++ b/frontend/packages/project-ide/biz-workflow/src/conversation/hooks/use-delete-chat/index.tsx @@ -16,6 +16,7 @@ import React, { useMemo, useState } from 'react'; +import { useIDEGlobalStore } from '@coze-project-ide/framework'; import { I18n } from '@coze-arch/i18n'; import { IconCozChat } from '@coze-arch/coze-design/icons'; import { Modal, Select, Typography, Toast } from '@coze-arch/coze-design'; @@ -24,9 +25,8 @@ import { type ProjectConversation, } from '@coze-arch/bot-api/workflow_api'; import { workflowApi } from '@coze-arch/bot-api'; -import { useIDEGlobalStore } from '@coze-project-ide/framework'; -import { DEFAULT_UNIQUE_ID, DEFAULT_CONVERSATION_NAME } from '../../constants'; +import { DEFAULT_CONVERSATION_NAME } from '../../constants'; import s from './index.module.less'; @@ -154,7 +154,7 @@ export const useDeleteChat = ({ style={{ width: '50%' }} dropdownStyle={{ width: 220 }} size="small" - defaultValue={DEFAULT_UNIQUE_ID} + defaultValue={optionList[0]?.value} optionList={optionList} onChange={value => { const selectItem = staticList.find( diff --git a/frontend/packages/project-ide/biz-workflow/src/conversation/static-chat-list/index.tsx b/frontend/packages/project-ide/biz-workflow/src/conversation/static-chat-list/index.tsx index 152bd4a860..1c10aa6da3 100644 --- a/frontend/packages/project-ide/biz-workflow/src/conversation/static-chat-list/index.tsx +++ b/frontend/packages/project-ide/biz-workflow/src/conversation/static-chat-list/index.tsx @@ -30,7 +30,7 @@ import { type ProjectConversation } from '@coze-arch/bot-api/workflow_api'; import { TitleWithTooltip } from '../title-with-tooltip'; import commonStyles from '../conversation-content/index.module.less'; import { EditInput } from '../conversation-content/edit-input'; -import { DEFAULT_UNIQUE_ID, type ErrorCode } from '../constants'; +import { type ErrorCode } from '../constants'; import s from './index.module.less'; @@ -140,9 +140,7 @@ export const StaticChatList = ({ {item.conversation_name} )} - {editingUniqueId === item.unique_id || - item.unique_id === DEFAULT_UNIQUE_ID || - !canEdit ? null : ( + {editingUniqueId === item.unique_id || !canEdit ? null : (
= ({ ?.defaultValue || ''; const findItem = list.find(item => item.label === defaultName); // The conversation_name of the start node is selected by default, if not, Default default session is selected by default - handleChange(findItem?.value || '0', findItem); + handleChange(findItem?.value || list[0]?.value, findItem || list[0]); } }; @@ -155,7 +155,6 @@ export const Conversations: React.FC = ({ findItem?.value !== chatflowService.selectConversationItem?.value ) { chatflowService.setSelectConversationItem(findItem); - handleChange(findItem?.value || '0'); } }, [value, staticList, dynamicList]);