feat: Support for Chat Flow & Agent Support for binding a single chat flow (#765)
Co-authored-by: Yu Yang <72337138+tomasyu985@users.noreply.github.com> Co-authored-by: zengxiaohui <csu.zengxiaohui@gmail.com> Co-authored-by: lijunwen.gigoo <lijunwen.gigoo@bytedance.com> Co-authored-by: lvxinyu.1117 <lvxinyu.1117@bytedance.com> Co-authored-by: liuyunchao.0510 <liuyunchao.0510@bytedance.com> Co-authored-by: haozhenfei <37089575+haozhenfei@users.noreply.github.com> Co-authored-by: July <jiangxujin@bytedance.com> Co-authored-by: tecvan-fe <fanwenjie.fe@bytedance.com>
This commit is contained in:
@@ -17,12 +17,12 @@
|
||||
import React, { Suspense, lazy, useMemo } from 'react';
|
||||
|
||||
import { userStoreService } from '@coze-studio/user-store';
|
||||
import type { IProject } from '@coze-studio/open-chat';
|
||||
import { useIDEGlobalStore } from '@coze-project-ide/framework';
|
||||
import { I18n } from '@coze-arch/i18n';
|
||||
import { IconCozIllusAdd } from '@coze-arch/coze-design/illustrations';
|
||||
import { EmptyState } from '@coze-arch/coze-design';
|
||||
import { CreateEnv } from '@coze-arch/bot-api/workflow_api';
|
||||
import type { IProject } from '@coze-studio/open-chat';
|
||||
import { useIDEGlobalStore } from '@coze-project-ide/framework';
|
||||
|
||||
import { DISABLED_CONVERSATION } from '../constants';
|
||||
import { useSkeleton } from './use-skeleton';
|
||||
@@ -81,8 +81,8 @@ export const ChatHistory: React.FC<ChatHistoryProps> = ({
|
||||
|
||||
const chatUserInfo = {
|
||||
id: userInfo?.user_id_str || '',
|
||||
name: userInfo?.name || '',
|
||||
avatar: userInfo?.avatar_url || '',
|
||||
nickname: userInfo?.name || '',
|
||||
url: userInfo?.avatar_url || '',
|
||||
};
|
||||
|
||||
if (
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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}
|
||||
</Text>
|
||||
)}
|
||||
{editingUniqueId === item.unique_id ||
|
||||
item.unique_id === DEFAULT_UNIQUE_ID ||
|
||||
!canEdit ? null : (
|
||||
{editingUniqueId === item.unique_id || !canEdit ? null : (
|
||||
<div className={commonStyles.icons}>
|
||||
<IconButton
|
||||
size="small"
|
||||
|
||||
@@ -41,10 +41,10 @@ import {
|
||||
usePrimarySidebarStore,
|
||||
} from '@coze-project-ide/biz-components';
|
||||
import { I18n } from '@coze-arch/i18n';
|
||||
import { Toast } from '@coze-arch/coze-design';
|
||||
import { WorkflowMode } from '@coze-arch/bot-api/workflow_api';
|
||||
import { ResourceCopyScene } from '@coze-arch/bot-api/plugin_develop';
|
||||
import { workflowApi } from '@coze-arch/bot-api';
|
||||
import { Toast } from '@coze-arch/coze-design';
|
||||
|
||||
import { WORKFLOW_SUB_TYPE_ICON_MAP } from '@/constants';
|
||||
import { WorkflowTooltip } from '@/components';
|
||||
@@ -233,33 +233,29 @@ export const useWorkflowResource = (): UseWorkflowResourceReturn => {
|
||||
subType: WorkflowMode.Workflow,
|
||||
tooltip: <WorkflowTooltip flowMode={WorkflowMode.Workflow} />,
|
||||
},
|
||||
// The open-source version does not currently support conversation streaming
|
||||
IS_OPEN_SOURCE
|
||||
? null
|
||||
: {
|
||||
icon: WORKFLOW_SUB_TYPE_ICON_MAP[WorkflowMode.ChatFlow],
|
||||
label: I18n.t('project_resource_sidebar_create_new_resource', {
|
||||
resource: I18n.t('wf_chatflow_76'),
|
||||
}),
|
||||
subType: WorkflowMode.ChatFlow,
|
||||
tooltip: <WorkflowTooltip flowMode={WorkflowMode.ChatFlow} />,
|
||||
},
|
||||
{
|
||||
icon: WORKFLOW_SUB_TYPE_ICON_MAP[WorkflowMode.ChatFlow],
|
||||
label: I18n.t('project_resource_sidebar_create_new_resource', {
|
||||
resource: I18n.t('wf_chatflow_76'),
|
||||
}),
|
||||
subType: WorkflowMode.ChatFlow,
|
||||
tooltip: <WorkflowTooltip flowMode={WorkflowMode.ChatFlow} />,
|
||||
},
|
||||
].filter(Boolean) as ResourceFolderCozeProps['createResourceConfig'],
|
||||
[],
|
||||
);
|
||||
|
||||
const iconRender: ResourceFolderCozeProps['iconRender'] = useMemo(
|
||||
() =>
|
||||
({ resource }) =>
|
||||
(
|
||||
<>
|
||||
{
|
||||
WORKFLOW_SUB_TYPE_ICON_MAP[
|
||||
resource.res_sub_type || WorkflowMode.Workflow
|
||||
]
|
||||
}
|
||||
</>
|
||||
),
|
||||
({ resource }) => (
|
||||
<>
|
||||
{
|
||||
WORKFLOW_SUB_TYPE_ICON_MAP[
|
||||
resource.res_sub_type || WorkflowMode.Workflow
|
||||
]
|
||||
}
|
||||
</>
|
||||
),
|
||||
[],
|
||||
);
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
"@coze-studio/publish-manage-hooks": "workspace:*",
|
||||
"@coze-studio/user-store": "workspace:*",
|
||||
"@coze-workflow/base": "workspace:*",
|
||||
"@coze/api": "1.1.0-beta.4",
|
||||
"@coze/api": "1.3.5",
|
||||
"ahooks": "^3.7.8",
|
||||
"classnames": "^2.3.2",
|
||||
"dayjs": "^1.11.7",
|
||||
|
||||
@@ -90,22 +90,19 @@ export const Configuration = () => {
|
||||
onClick={handleSwitchExpand}
|
||||
/>
|
||||
</div>
|
||||
{/* will support soon */}
|
||||
{IS_OPEN_SOURCE ? null : (
|
||||
<div
|
||||
className={classnames(
|
||||
styles.item,
|
||||
compareURI(context?.uri, SESSION_CONFIG_URI) && styles.activate,
|
||||
)}
|
||||
onClick={handleOpenSession}
|
||||
>
|
||||
<IconCozChatSetting
|
||||
className="coz-fg-plus"
|
||||
style={{ marginRight: 4 }}
|
||||
/>
|
||||
{I18n.t('wf_chatflow_101')}
|
||||
</div>
|
||||
)}
|
||||
<div
|
||||
className={classnames(
|
||||
styles.item,
|
||||
compareURI(context?.uri, SESSION_CONFIG_URI) && styles.activate,
|
||||
)}
|
||||
onClick={handleOpenSession}
|
||||
>
|
||||
<IconCozChatSetting
|
||||
className="coz-fg-plus"
|
||||
style={{ marginRight: 4 }}
|
||||
/>
|
||||
{I18n.t('wf_chatflow_101')}
|
||||
</div>
|
||||
<div
|
||||
className={classnames(
|
||||
styles.item,
|
||||
|
||||
@@ -73,8 +73,7 @@ const ProjectIDE: React.FC<ProjectIDEProps> = memo(
|
||||
() => ({
|
||||
view: {
|
||||
widgetRegistries: [
|
||||
// will support soon
|
||||
...(IS_OPEN_SOURCE ? [] : [ConversationRegistry]),
|
||||
ConversationRegistry,
|
||||
WorkflowWidgetRegistry,
|
||||
DatabaseWidgetRegistry,
|
||||
KnowledgeWidgetRegistry,
|
||||
|
||||
Reference in New Issue
Block a user