mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 02:18:08 +08:00
merge main
This commit is contained in:
@ -469,8 +469,8 @@ const Configuration: FC = () => {
|
||||
transfer_methods: modelConfig.file_upload?.image?.transfer_methods || ['local_file', 'remote_url'],
|
||||
},
|
||||
enabled: !!(modelConfig.file_upload?.enabled || modelConfig.file_upload?.image?.enabled),
|
||||
allowed_file_types: modelConfig.file_upload?.allowed_file_types || [SupportUploadFileTypes.image],
|
||||
allowed_file_extensions: modelConfig.file_upload?.allowed_file_extensions || FILE_EXTS[SupportUploadFileTypes.image].map(ext => `.${ext}`),
|
||||
allowed_file_types: modelConfig.file_upload?.allowed_file_types || [SupportUploadFileTypes.image, SupportUploadFileTypes.video],
|
||||
allowed_file_extensions: modelConfig.file_upload?.allowed_file_extensions || [...FILE_EXTS[SupportUploadFileTypes.image], ...FILE_EXTS[SupportUploadFileTypes.video]].map(ext => `.${ext}`),
|
||||
allowed_file_upload_methods: modelConfig.file_upload?.allowed_file_upload_methods || modelConfig.file_upload?.image?.transfer_methods || ['local_file', 'remote_url'],
|
||||
number_limits: modelConfig.file_upload?.number_limits || modelConfig.file_upload?.image?.number_limits || 3,
|
||||
fileUploadConfig: fileUploadConfigResponse,
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
import {
|
||||
useCallback,
|
||||
useRef,
|
||||
useState,
|
||||
} from 'react'
|
||||
import Textarea from 'rc-textarea'
|
||||
@ -63,7 +62,6 @@ const ChatInputArea = ({
|
||||
isMultipleLine,
|
||||
} = useTextAreaHeight()
|
||||
const [query, setQuery] = useState('')
|
||||
const isUseInputMethod = useRef(false)
|
||||
const [showVoiceInput, setShowVoiceInput] = useState(false)
|
||||
const filesStore = useFileStore()
|
||||
const {
|
||||
@ -95,20 +93,11 @@ const ChatInputArea = ({
|
||||
}
|
||||
}
|
||||
|
||||
const handleKeyUp = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
|
||||
if (e.key === 'Enter') {
|
||||
e.preventDefault()
|
||||
// prevent send message when using input method enter
|
||||
if (!e.shiftKey && !isUseInputMethod.current)
|
||||
handleSend()
|
||||
}
|
||||
}
|
||||
|
||||
const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
|
||||
isUseInputMethod.current = e.nativeEvent.isComposing
|
||||
if (e.key === 'Enter' && !e.shiftKey) {
|
||||
setQuery(query.replace(/\n$/, ''))
|
||||
if (e.key === 'Enter' && !e.shiftKey && !e.nativeEvent.isComposing) {
|
||||
e.preventDefault()
|
||||
setQuery(query.replace(/\n$/, ''))
|
||||
handleSend()
|
||||
}
|
||||
}
|
||||
|
||||
@ -165,7 +154,6 @@ const ChatInputArea = ({
|
||||
setQuery(e.target.value)
|
||||
handleTextareaResize()
|
||||
}}
|
||||
onKeyUp={handleKeyUp}
|
||||
onKeyDown={handleKeyDown}
|
||||
onPaste={handleClipboardPasteFile}
|
||||
onDragEnter={handleDragFileEnter}
|
||||
|
||||
@ -120,7 +120,7 @@ const ConfigCredential: FC<Props> = ({
|
||||
<input
|
||||
value={tempCredential.api_key_header}
|
||||
onChange={e => setTempCredential({ ...tempCredential, api_key_header: e.target.value })}
|
||||
className='w-full h-10 px-3 text-sm font-normal bg-gray-100 rounded-lg grow'
|
||||
className='w-full h-10 px-3 text-sm font-normal border border-transparent bg-gray-100 rounded-lg grow outline-none focus:bg-components-input-bg-active focus:border-components-input-border-active focus:shadow-xs'
|
||||
placeholder={t('tools.createTool.authMethod.types.apiKeyPlaceholder')!}
|
||||
/>
|
||||
</div>
|
||||
@ -129,7 +129,7 @@ const ConfigCredential: FC<Props> = ({
|
||||
<input
|
||||
value={tempCredential.api_key_value}
|
||||
onChange={e => setTempCredential({ ...tempCredential, api_key_value: e.target.value })}
|
||||
className='w-full h-10 px-3 text-sm font-normal bg-gray-100 rounded-lg grow'
|
||||
className='w-full h-10 px-3 text-sm font-normal border border-transparent bg-gray-100 rounded-lg grow outline-none focus:bg-components-input-bg-active focus:border-components-input-border-active focus:shadow-xs'
|
||||
placeholder={t('tools.createTool.authMethod.types.apiValuePlaceholder')!}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@ -70,7 +70,7 @@ const GetSchema: FC<Props> = ({
|
||||
<div className='relative'>
|
||||
<input
|
||||
type='text'
|
||||
className='w-[244px] h-8 pl-1.5 pr-[44px] overflow-x-auto border border-gray-200 rounded-lg text-[13px]'
|
||||
className='w-[244px] h-8 pl-1.5 pr-[44px] overflow-x-auto border border-gray-200 rounded-lg text-[13px] focus:outline-none focus:border-components-input-border-active'
|
||||
placeholder={t('tools.createTool.importFromUrlPlaceHolder')!}
|
||||
value={importUrl}
|
||||
onChange={e => setImportUrl(e.target.value)}
|
||||
@ -89,7 +89,7 @@ const GetSchema: FC<Props> = ({
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className='relative' ref={showExamplesRef}>
|
||||
<div className='relative -mt-0.5' ref={showExamplesRef}>
|
||||
<Button
|
||||
size='small'
|
||||
className='space-x-1'
|
||||
|
||||
@ -22,7 +22,7 @@ import LabelSelector from '@/app/components/tools/labels/selector'
|
||||
import Toast from '@/app/components/base/toast'
|
||||
|
||||
const fieldNameClassNames = 'py-2 leading-5 text-sm font-medium text-gray-900'
|
||||
interface Props {
|
||||
type Props = {
|
||||
positionLeft?: boolean
|
||||
payload: any
|
||||
onHide: () => void
|
||||
@ -186,8 +186,8 @@ const EditCustomCollectionModal: FC<Props> = ({
|
||||
positionCenter={isAdd && !positionLeft}
|
||||
onHide={onHide}
|
||||
title={t(`tools.createTool.${isAdd ? 'title' : 'editTitle'}`)!}
|
||||
panelClassName='mt-2 !w-[630px]'
|
||||
maxWidthClassName='!max-w-[630px]'
|
||||
panelClassName='mt-2 !w-[640px]'
|
||||
maxWidthClassName='!max-w-[640px]'
|
||||
height='calc(100vh - 16px)'
|
||||
headerClassName='!border-b-black/5'
|
||||
body={
|
||||
|
||||
@ -27,8 +27,8 @@ const Contribute = ({ onRefreshData }: Props) => {
|
||||
|
||||
const linkUrl = useMemo(() => {
|
||||
if (language.startsWith('zh_'))
|
||||
return 'https://docs.dify.ai/v/zh-hans/guides/gong-ju/quick-tool-integration'
|
||||
return 'https://docs.dify.ai/tutorials/quick-tool-integration'
|
||||
return 'https://docs.dify.ai/zh-hans/guides/tools#ru-he-chuang-jian-zi-ding-yi-gong-ju'
|
||||
return 'https://docs.dify.ai/guides/tools#how-to-create-custom-tools'
|
||||
}, [language])
|
||||
|
||||
const [isShowEditCollectionToolModal, setIsShowEditCustomCollectionModal] = useState(false)
|
||||
|
||||
@ -36,7 +36,6 @@ export enum ControlMode {
|
||||
Pointer = 'pointer',
|
||||
Hand = 'hand',
|
||||
}
|
||||
|
||||
export enum ErrorHandleMode {
|
||||
Terminated = 'terminated',
|
||||
ContinueOnError = 'continue-on-error',
|
||||
@ -73,7 +72,7 @@ export type CommonNodeType<T = {}> = {
|
||||
height?: number
|
||||
} & T & Partial<Pick<ToolDefaultValue, 'provider_id' | 'provider_type' | 'provider_name' | 'tool_name'>>
|
||||
|
||||
export interface CommonEdgeType {
|
||||
export type CommonEdgeType = {
|
||||
_hovering?: boolean
|
||||
_connectedNodeIsHovering?: boolean
|
||||
_connectedNodeIsSelected?: boolean
|
||||
@ -87,14 +86,14 @@ export interface CommonEdgeType {
|
||||
|
||||
export type Node<T = {}> = ReactFlowNode<CommonNodeType<T>>
|
||||
export type SelectedNode = Pick<Node, 'id' | 'data'>
|
||||
export interface NodeProps<T = unknown> { id: string; data: CommonNodeType<T> }
|
||||
export interface NodePanelProps<T> {
|
||||
export type NodeProps<T = unknown> = { id: string; data: CommonNodeType<T> }
|
||||
export type NodePanelProps<T> = {
|
||||
id: string
|
||||
data: CommonNodeType<T>
|
||||
}
|
||||
export type Edge = ReactFlowEdge<CommonEdgeType>
|
||||
|
||||
export interface WorkflowDataUpdater {
|
||||
export type WorkflowDataUpdater = {
|
||||
nodes: Node[]
|
||||
edges: Edge[]
|
||||
viewport: Viewport
|
||||
@ -102,7 +101,7 @@ export interface WorkflowDataUpdater {
|
||||
|
||||
export type ValueSelector = string[] // [nodeId, key | obj key path]
|
||||
|
||||
export interface Variable {
|
||||
export type Variable = {
|
||||
variable: string
|
||||
label?: string | {
|
||||
nodeType: BlockEnum
|
||||
@ -117,14 +116,14 @@ export interface Variable {
|
||||
isParagraph?: boolean
|
||||
}
|
||||
|
||||
export interface EnvironmentVariable {
|
||||
export type EnvironmentVariable = {
|
||||
id: string
|
||||
name: string
|
||||
value: any
|
||||
value_type: 'string' | 'number' | 'secret'
|
||||
}
|
||||
|
||||
export interface ConversationVariable {
|
||||
export type ConversationVariable = {
|
||||
id: string
|
||||
name: string
|
||||
value_type: ChatVarType
|
||||
@ -132,13 +131,13 @@ export interface ConversationVariable {
|
||||
description: string
|
||||
}
|
||||
|
||||
export interface GlobalVariable {
|
||||
export type GlobalVariable = {
|
||||
name: string
|
||||
value_type: 'string' | 'number'
|
||||
description: string
|
||||
}
|
||||
|
||||
export interface VariableWithValue {
|
||||
export type VariableWithValue = {
|
||||
key: string
|
||||
value: string
|
||||
}
|
||||
@ -174,7 +173,7 @@ export type InputVar = {
|
||||
value_selector?: ValueSelector
|
||||
} & Partial<UploadFileSetting>
|
||||
|
||||
export interface ModelConfig {
|
||||
export type ModelConfig = {
|
||||
provider: string
|
||||
name: string
|
||||
mode: string
|
||||
@ -192,7 +191,7 @@ export enum EditionType {
|
||||
jinja2 = 'jinja2',
|
||||
}
|
||||
|
||||
export interface PromptItem {
|
||||
export type PromptItem = {
|
||||
id?: string
|
||||
role?: PromptRole
|
||||
text: string
|
||||
@ -205,12 +204,12 @@ export enum MemoryRole {
|
||||
assistant = 'assistant',
|
||||
}
|
||||
|
||||
export interface RolePrefix {
|
||||
export type RolePrefix = {
|
||||
user: string
|
||||
assistant: string
|
||||
}
|
||||
|
||||
export interface Memory {
|
||||
export type Memory = {
|
||||
role_prefix?: RolePrefix
|
||||
window: {
|
||||
enabled: boolean
|
||||
@ -234,7 +233,7 @@ export enum VarType {
|
||||
any = 'any',
|
||||
}
|
||||
|
||||
export interface Var {
|
||||
export type Var = {
|
||||
variable: string
|
||||
type: VarType
|
||||
children?: Var[] // if type is obj, has the children struct
|
||||
@ -245,21 +244,21 @@ export interface Var {
|
||||
des?: string
|
||||
}
|
||||
|
||||
export interface NodeOutPutVar {
|
||||
export type NodeOutPutVar = {
|
||||
nodeId: string
|
||||
title: string
|
||||
vars: Var[]
|
||||
isStartNode?: boolean
|
||||
}
|
||||
|
||||
export interface Block {
|
||||
export type Block = {
|
||||
classification?: string
|
||||
type: BlockEnum
|
||||
title: string
|
||||
description?: string
|
||||
}
|
||||
|
||||
export interface NodeDefault<T> {
|
||||
export type NodeDefault<T> = {
|
||||
defaultValue: Partial<T>
|
||||
getAvailablePrevNodes: (isChatMode: boolean) => BlockEnum[]
|
||||
getAvailableNextNodes: (isChatMode: boolean) => BlockEnum[]
|
||||
@ -299,19 +298,19 @@ export type OnNodeAdd = (
|
||||
}
|
||||
) => void
|
||||
|
||||
export interface CheckValidRes {
|
||||
export type CheckValidRes = {
|
||||
isValid: boolean
|
||||
errorMessage?: string
|
||||
}
|
||||
|
||||
export interface RunFile {
|
||||
export type RunFile = {
|
||||
type: string
|
||||
transfer_method: TransferMethod[]
|
||||
url?: string
|
||||
upload_file_id?: string
|
||||
}
|
||||
|
||||
export interface WorkflowRunningData {
|
||||
export type WorkflowRunningData = {
|
||||
task_id?: string
|
||||
message_id?: string
|
||||
conversation_id?: string
|
||||
@ -336,7 +335,7 @@ export interface WorkflowRunningData {
|
||||
tracing?: NodeTracing[]
|
||||
}
|
||||
|
||||
export interface HistoryWorkflowData {
|
||||
export type HistoryWorkflowData = {
|
||||
id: string
|
||||
sequence_number: number
|
||||
status: string
|
||||
@ -348,7 +347,7 @@ export enum ChangeType {
|
||||
remove = 'remove',
|
||||
}
|
||||
|
||||
export interface MoreInfo {
|
||||
export type MoreInfo = {
|
||||
type: ChangeType
|
||||
payload?: {
|
||||
beforeKey: string
|
||||
@ -368,7 +367,7 @@ export enum SupportUploadFileTypes {
|
||||
custom = 'custom',
|
||||
}
|
||||
|
||||
export interface UploadFileSetting {
|
||||
export type UploadFileSetting = {
|
||||
allowed_file_upload_methods: TransferMethod[]
|
||||
allowed_file_types: SupportUploadFileTypes[]
|
||||
allowed_file_extensions?: string[]
|
||||
@ -376,7 +375,7 @@ export interface UploadFileSetting {
|
||||
number_limits?: number
|
||||
}
|
||||
|
||||
export interface VisionSetting {
|
||||
export type VisionSetting = {
|
||||
variable_selector: ValueSelector
|
||||
detail: Resolution
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user