feat: support dialogue count in chatflow (#7440)
This commit is contained in:
@@ -3,7 +3,9 @@ import type { FC } from 'react'
|
||||
import React, { useCallback } from 'react'
|
||||
import type { VariantProps } from 'class-variance-authority'
|
||||
import { cva } from 'class-variance-authority'
|
||||
import { RiQuestionLine } from '@remixicon/react'
|
||||
import cn from '@/utils/classnames'
|
||||
import TooltipPlus from '@/app/components/base/tooltip-plus'
|
||||
|
||||
const variants = cva([], {
|
||||
variants: {
|
||||
@@ -26,6 +28,7 @@ type Props = {
|
||||
selected: boolean
|
||||
disabled?: boolean
|
||||
align?: 'left' | 'center' | 'right'
|
||||
tooltip?: string
|
||||
} & VariantProps<typeof variants>
|
||||
|
||||
const OptionCard: FC<Props> = ({
|
||||
@@ -35,6 +38,7 @@ const OptionCard: FC<Props> = ({
|
||||
selected,
|
||||
disabled,
|
||||
align = 'center',
|
||||
tooltip,
|
||||
}) => {
|
||||
const handleSelect = useCallback(() => {
|
||||
if (selected || disabled)
|
||||
@@ -54,7 +58,14 @@ const OptionCard: FC<Props> = ({
|
||||
)}
|
||||
onClick={handleSelect}
|
||||
>
|
||||
{title}
|
||||
<span>{title}</span>
|
||||
{tooltip && <TooltipPlus
|
||||
popupContent={<div className='w-[240px]'>
|
||||
{tooltip}
|
||||
</div>}
|
||||
>
|
||||
<RiQuestionLine className='ml-0.5 w-[14px] h-[14px] text-text-quaternary' />
|
||||
</TooltipPlus>}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
@@ -99,6 +99,10 @@ const formatItem = (
|
||||
variable: 'sys.query',
|
||||
type: VarType.string,
|
||||
})
|
||||
res.vars.push({
|
||||
variable: 'sys.dialogue_count',
|
||||
type: VarType.number,
|
||||
})
|
||||
res.vars.push({
|
||||
variable: 'sys.conversation_id',
|
||||
type: VarType.string,
|
||||
|
@@ -49,7 +49,6 @@ const Panel: FC<NodePanelProps<AssignerNodeType>> = ({
|
||||
</Field>
|
||||
<Field
|
||||
title={t(`${i18nPrefix}.writeMode`)}
|
||||
tooltip={t(`${i18nPrefix}.writeModeTip`)!}
|
||||
>
|
||||
<div className={cn('grid gap-2 grid-cols-3')}>
|
||||
{writeModeTypes.map(type => (
|
||||
@@ -59,6 +58,7 @@ const Panel: FC<NodePanelProps<AssignerNodeType>> = ({
|
||||
onSelect={handleWriteModeChange(type)}
|
||||
selected={inputs.write_mode === type}
|
||||
disabled={!isSupportAppend && type === WriteMode.Append}
|
||||
tooltip={type === WriteMode.Append ? t(`${i18nPrefix}.writeModeTip`)! : undefined}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
@@ -84,17 +84,30 @@ const Panel: FC<NodePanelProps<StartNodeType>> = ({
|
||||
/>
|
||||
{
|
||||
isChatMode && (
|
||||
<VarItem
|
||||
readonly
|
||||
payload={{
|
||||
variable: 'sys.conversation_id',
|
||||
} as any}
|
||||
rightContent={
|
||||
<div className='text-xs font-normal text-gray-500'>
|
||||
String
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
<>
|
||||
<VarItem
|
||||
readonly
|
||||
payload={{
|
||||
variable: 'sys.dialogue_count',
|
||||
} as any}
|
||||
rightContent={
|
||||
<div className='text-xs font-normal text-gray-500'>
|
||||
Number
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
<VarItem
|
||||
readonly
|
||||
payload={{
|
||||
variable: 'sys.conversation_id',
|
||||
} as any}
|
||||
rightContent={
|
||||
<div className='text-xs font-normal text-gray-500'>
|
||||
String
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
<VarItem
|
||||
|
Reference in New Issue
Block a user