File input (#2270)

* doc

* feat: file upload  config

* perf: chat box file params

* feat: markdown show file

* feat: chat file store and clear

* perf: read file contentType

* feat: llm vision config

* feat: file url output

* perf: plugin error text

* perf: image load

* feat: ai chat document

* perf: file block ui

* feat: read file node

* feat: file read response field

* feat: simple mode support read files

* feat: tool call

* feat: read file histories

* perf: select file

* perf: select file config

* i18n

* i18n

* fix: ts; feat: tool response preview result
This commit is contained in:
Archer
2024-08-06 10:00:22 +08:00
committed by GitHub
parent 10dcdb5491
commit e36d9d794f
121 changed files with 2600 additions and 1142 deletions

View File

@@ -80,6 +80,7 @@ export const iconPaths = {
'core/app/simpleMode/ai': () => import('./icons/core/app/simpleMode/ai.svg'),
'core/app/simpleMode/chat': () => import('./icons/core/app/simpleMode/chat.svg'),
'core/app/simpleMode/dataset': () => import('./icons/core/app/simpleMode/dataset.svg'),
'core/app/simpleMode/file': () => import('./icons/core/app/simpleMode/file.svg'),
'core/app/simpleMode/template': () => import('./icons/core/app/simpleMode/template.svg'),
'core/app/simpleMode/tts': () => import('./icons/core/app/simpleMode/tts.svg'),
'core/app/simpleMode/variable': () => import('./icons/core/app/simpleMode/variable.svg'),

View File

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 21" fill="none">
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.3137 2.1798C12.6304 2.36279 12.9051 2.62076 13.4545 3.13669L15.8777 5.41226C16.4766 5.97467 16.7761 6.25591 16.9893 6.59022C17.1705 6.87433 17.3052 7.18555 17.3883 7.51211C17.486 7.89638 17.486 8.30718 17.486 9.12879V13.9567C17.486 15.76 17.486 16.6617 17.1295 17.3481C16.8291 17.9264 16.3575 18.398 15.7791 18.6985C15.0928 19.055 14.1911 19.055 12.3877 19.055H7.61249C5.80911 19.055 4.90741 19.055 4.22107 18.6985C3.6427 18.398 3.17112 17.9264 2.87068 17.3481C2.51416 16.6617 2.51416 15.76 2.51416 13.9567V6.85322C2.51416 5.04983 2.51416 4.14814 2.87068 3.4618C3.17112 2.88343 3.6427 2.41185 4.22107 2.11141C4.90741 1.75488 5.80911 1.75488 7.61249 1.75488H9.96446C10.7181 1.75488 11.095 1.75488 11.4511 1.83825C11.7538 1.90913 12.0445 2.02421 12.3137 2.1798ZM11.9441 4.28211C11.4498 3.80811 11.2026 3.57111 10.9904 3.56252C10.8219 3.55569 10.6593 3.62507 10.5476 3.75142C10.407 3.9105 10.407 4.25295 10.407 4.93784V5.71981C10.407 6.72166 10.407 7.22259 10.602 7.60524C10.7735 7.94183 11.0471 8.21549 11.3837 8.387C11.7664 8.58197 12.2673 8.58197 13.2691 8.58197H14.1686C14.8896 8.58197 15.2501 8.58197 15.4105 8.43647C15.5377 8.32102 15.605 8.15364 15.593 7.98227C15.578 7.76628 15.3178 7.51678 14.7974 7.0178L11.9441 4.28211ZM5.8374 11.8018C5.8374 11.3416 6.21049 10.9685 6.67073 10.9685H13.3331C13.7934 10.9685 14.1665 11.3416 14.1665 11.8018C14.1665 12.262 13.7934 12.6351 13.3331 12.6351H6.67073C6.21049 12.6351 5.8374 12.262 5.8374 11.8018ZM5.82763 14.9253C5.82763 14.4651 6.20073 14.092 6.66096 14.092H11.6623C12.1226 14.092 12.4956 14.4651 12.4956 14.9253C12.4956 15.3855 12.1225 15.7586 11.6623 15.7586H6.66096C6.20073 15.7586 5.82763 15.3855 5.82763 14.9253Z" fill="#00A9A6"/>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -1,10 +1,10 @@
import React, { useMemo, useRef } from 'react';
import MyMenu, { type Props as MyMenuProps } from '../../common/MyMenu';
import MyMenu from '../../common/MyMenu';
import {
FlowNodeInputMap,
FlowNodeInputTypeEnum
} from '@fastgpt/global/core/workflow/node/constant';
import { Box, Button, Flex, useTheme } from '@chakra-ui/react';
import { Box, Button, useTheme } from '@chakra-ui/react';
import MyIcon from '../../common/Icon';
import { useTranslation } from 'next-i18next';
import { useConfirm } from '../../../hooks/useConfirm';
@@ -142,11 +142,13 @@ const NodeInputSelect = ({
return (
<MyMenu
offset={[-0.5, -0.5]}
offset={[-0.5, 0.5]}
trigger="click"
Button={
<Button
size={'xs'}
leftIcon={<MyIcon name={renderTypeData.icon as any} w={'14px'} />}
leftIcon={<MyIcon name={renderTypeData.icon as any} w={'0.8rem'} />}
rightIcon={<MyIcon name={'common/select'} w={'0.8rem'} color={'myGray.500'} />}
variant={'grayBase'}
border={theme.borders.base}
borderRadius={'xs'}

View File

@@ -0,0 +1,22 @@
import { useMemo } from 'react';
export const useWidthVariable = <T = any>({
width,
widthList = [900, 1200, 1500, 1800, 2100],
list
}: {
width: number;
widthList?: number[];
list: T[];
}) => {
const value = useMemo(() => {
// 根据 width 计算,找到第一个大于 width 的值
const index = widthList.findLastIndex((item) => width > item);
if (index === -1) {
return list[0];
}
return list[index];
}, [list, width, widthList]);
return value;
};

View File

@@ -12,6 +12,7 @@
"chat_debug": "Chat Debug",
"chat_logs": "Chat Logs",
"chat_logs_tips": "Logs will record online, shared and API (chatId required) conversation records for this app",
"config_file_upload": "Click to configure file upload rules",
"confirm_copy_app_tip": "The system will create an application with the same configuration for you, but the permission will not be copied, please confirm!",
"confirm_del_app_tip": "Confirm to delete this app and all its chat records?",
"confirm_delete_folder_tip": "Are you sure to delete this folder? All the following applications and corresponding chat records will be deleted, please confirm!",
@@ -25,14 +26,21 @@
},
"current_settings": "Current settings",
"day": "day",
"document_quote": "Document quote",
"document_quote_tip": "It is usually used to accept document content uploaded by users (which requires document parsing), and can also be used to reference other string data.",
"document_upload": "Document upload",
"edit_app": "Edit app",
"edit_info": "Edit info",
"execute_time": "execution time",
"export_config_successful": "Config copied, please check for important data",
"export_configs": "Export Configs",
"feedback_count": "User Feedback",
"file_upload": "file_upload",
"file_upload_tip": "After it is enabled, you can upload documents/pictures. Documents are kept for 7 days and pictures for 15 days. Use of this feature may incur additional charges. To ensure the user experience, select an AI model with a large context length when using this function.",
"go_to_chat": "To chat",
"go_to_run": "Run",
"image_upload": "Image upload",
"image_upload_tip": "Be sure to select a visual model that can handle the picture",
"import_configs": "Import Configs",
"import_configs_failed": "Failed to import configs, please ensure configs are valid!",
"interval": {
@@ -44,6 +52,9 @@
"per_hour": "per hour"
},
"intro": "It is a large model application orchestration system that provides out-of-the-box data processing, model calling and other capabilities. It can quickly build a knowledge base and perform workflow orchestration through Flow visualization to realize complex knowledge base scenarios!",
"llm_not_support_vision": "This model does not support image recognition",
"llm_use_vision": "Enable vision",
"llm_use_vision_tip": "When image recognition is enabled, the model automatically receives images from Dialog Uploads, as well as image links from User Questions.",
"logs_empty": "No logs yet~",
"logs_message_total": "Total Messages",
"logs_title": "Title",
@@ -92,6 +103,7 @@
"Simple bot": "Simple bot",
"Workflow bot": "Workflow"
},
"upload_file_max_amount": "Maximum number of files to be uploaded in a single round",
"version": {
"Revert success": "Revert success"
},
@@ -106,8 +118,15 @@
},
"workflow": {
"Input guide": "Input guide",
"file_url": "Url",
"read_files": "Documents parse",
"read_files_result": "Document parsing results",
"read_files_result_desc": "The original text of the document consists of the file name and the document content. Multiple files are separated by horizontal lines.",
"read_files_tip": "Parse the document link passed in the conversation and return the corresponding document content",
"template": {
"communication": "Communication"
}
},
"user_file_input": "Files url",
"user_file_input_desc": "Links to documents and images uploaded by users"
}
}

View File

@@ -15,20 +15,23 @@
"custom_input_guide_url": "Custom thesaurus address",
"empty_directory": "There is nothing left to choose from in this directory~",
"in_progress": "in progress",
"input_guide": "Enter boot",
"input_guide_lexicon": "vocabulary",
"input_guide_tip": "Some preset questions can be configured. \nWhen the user enters a question, relevant questions will be obtained from these preset questions for prompts.",
"insert_input_guide,_some_data_already_exists": "There is duplicate data, which has been automatically filtered. A total of {{len}} pieces of data have been inserted.",
"is_chatting": "Chatting...please wait for the end",
"items": "strip",
"module_runtime_and": "module run time and",
"multiple_AI_conversations": "Multiple AI conversations",
"new_chat": "new conversation",
"new_input_guide_lexicon": "New vocabulary",
"plugins_output": "Plugin output",
"question_tip": "From left to right, the response order of each module",
"rearrangement": "Search results rearranged",
"stream_output": "stream output",
"view_citations": "View citations",
"web_site_sync": "Web site synchronization"
"web_site_sync": "Web site synchronization",
"file_amount_over": "Exceed maximum number of files {{max}}",
"input_guide": "Input guide",
"input_guide_lexicon": "Lexicon",
"input_guide_tip": "You can configure some preset questions. When the user enters a question, the relevant question is retrieved from these preset questions for prompt.",
"insert_input_guide,_some_data_already_exists": "Duplicate data, automatically filtered, insert: {{len}} data",
"new_input_guide_lexicon": "New lexicon",
"select_file": "Select file",
"select_img": "Select images"
}

View File

@@ -508,7 +508,7 @@
"module cq result": "Classification result",
"module extract description": "Extract requirement description",
"module extract result": "Extraction result",
"module historyPreview": "Complete record",
"module historyPreview": "Record preview (only part of the content is displayed)",
"module http result": "response body",
"module if else Result": "Determinator result",
"module limit": "Single search limit",
@@ -670,7 +670,7 @@
"Total files": "A total of {{total}} files",
"Training mode": "Training mode",
"Upload data": "Upload data",
"Upload file progress": "File upload progress",
"Upload file progress": "file_upload progress",
"Upload status": "Status",
"Web link": "Web link",
"Web link desc": "Read static web page content as a dataset"
@@ -1330,6 +1330,7 @@
"minute": "minute"
},
"unusable_variable": "no usable variable",
"upload_file_error": "Upload file error",
"user": {
"Account": "Account",
"Amount of earnings": "Earnings (¥)",

View File

@@ -1,4 +1,6 @@
{
"bucket_chat": "Chat file",
"bucket_file": "Dataset file",
"click_to_view_raw_source": "View source",
"file_name": "File Name",
"file_size": "File Size",

View File

@@ -27,7 +27,19 @@
"Code log": "Log",
"Custom inputs": "Custom inputs",
"Custom outputs": "Custom outputs",
"Error": "Error"
"Error": "Error",
"Read file result": "Document parsing result preview",
"read files": "parsed document"
},
"template": {
"ai_chat": "LLM chat",
"ai_chat_intro": "Call the AI model for a conversation",
"dataset_search": "Dataset search",
"dataset_search_intro": "Call the \"Semantic Search\" and \"Full-text Search\" capabilities to find reference content that may be related to the problem from the \"Knowledge Base\"",
"system_config": "System Configuration",
"tool_call": "Tool call",
"tool_call_intro": "One or more function blocks are automatically selected for calling through the AI model, and plug-ins can also be called.",
"workflow_start": "Process starts"
},
"tool_input": "Tool",
"update_link_error": "Update link exception",

View File

@@ -13,21 +13,30 @@
"chat_debug": "调试预览",
"chat_logs": "对话日志",
"chat_logs_tips": "日志会记录该应用的在线、分享和 API需填写 chatId对话记录",
"config_file_upload": "点击配置文件上传规则",
"confirm_copy_app_tip": "系统将为您创建一个相同配置应用,但权限不会进行复制,请确认!",
"confirm_del_app_tip": "确认删除该应用及其所有聊天记录?",
"confirm_delete_folder_tip": "确认删除该文件夹?将会删除它下面所有应用及对应的聊天记录,请确认!",
"copy_one_app": "创建副本",
"create_copy_success": "创建副本成功",
"current_settings": "当前配置",
"document_upload": "文档上传",
"edit_app": "编辑应用",
"edit_info": "编辑信息",
"export_config_successful": "已复制配置,自动过滤部分敏感信息,请注意检查是否仍有敏感数据",
"export_configs": "导出配置",
"feedback_count": "用户反馈",
"file_upload": "文件上传",
"file_upload_tip": "开启后,可以上传文档/图片。文档保留7天图片保留15天。使用该功能可能产生较多额外费用。为保证使用体验使用该功能时请选择上下文长度较大的AI模型。",
"go_to_chat": "去对话",
"go_to_run": "去运行",
"image_upload": "图片上传",
"image_upload_tip": "请确保选择可处理图片的视觉模型",
"import_configs": "导入配置",
"import_configs_failed": "导入配置失败,请确保配置正常!",
"llm_not_support_vision": "该模型不支持图片识别",
"llm_use_vision": "启用图片识别",
"llm_use_vision_tip": "启用图片识别后,该模型会自动接收来自“对话框上传”的图片,以及“用户问题”中的图片链接。",
"logs_empty": "还没有日志噢~",
"logs_message_total": "消息总数",
"logs_title": "标题",
@@ -72,14 +81,22 @@
"Simple bot": "简易应用",
"Workflow bot": "工作流"
},
"upload_file_max_amount": "单轮最大文件上传数量",
"version": {
"Revert success": "回滚成功"
},
"workflow": {
"Input guide": "填写说明",
"file_url": "文档链接",
"read_files": "文档解析",
"read_files_result": "文档解析结果",
"read_files_result_desc": "文档原文,由文件名和文档内容组成,多个文件之间通过横线隔开。",
"read_files_tip": "解析对话中上传的文档,返回对应文档内容",
"template": {
"communication": "通信"
}
},
"user_file_input": "文件链接",
"user_file_input_desc": "用户上传的文档和图片链接"
},
"interval": {
"per_hour": "每小时",
@@ -109,5 +126,7 @@
},
"day": "日",
"execute_time": "执行时间",
"time_zone": "时区"
"time_zone": "时区",
"document_quote": "文档引用",
"document_quote_tip": "通常用于接受用户上传的文档内容(这需要文档解析),也可以用于引用其他字符串数据。"
}

View File

@@ -7,6 +7,7 @@
"csv_input_lexicon_tip": "仅支持 CSV 批量导入,点击下载模板",
"custom_input_guide_url": "自定义词库地址",
"delete_all_input_guide_confirm": "确定要清空输入引导词库吗?",
"file_amount_over": "超出最大文件数量 {{max}}",
"input_guide": "输入引导",
"input_guide_lexicon": "词库",
"input_guide_tip": "可以配置一些预设的问题。在用户输入问题时,会从这些预设问题中获取相关问题进行提示。",
@@ -30,5 +31,7 @@
"question_tip": "从上到下,为各个模块的响应顺序",
"rearrangement": "检索结果重排",
"web_site_sync": "Web站点同步",
"new_chat": "新对话"
"new_chat": "新对话",
"select_file": "选择文件",
"select_img": "选择图片"
}

View File

@@ -559,7 +559,7 @@
"module cq result": "分类结果",
"module extract description": "提取背景描述",
"module extract result": "提取结果",
"module historyPreview": "完整记录",
"module historyPreview": "记录预览(仅展示部分内容)",
"module http result": "响应体",
"module if else Result": "判断器结果",
"module limit": "单次搜索上限",
@@ -646,7 +646,8 @@
"success": "开始同步"
}
},
"training": {}
"training": {
}
},
"data": {
"Auxiliary Data": "辅助数据",
@@ -857,7 +858,7 @@
"AppSecret": "AppSecret",
"ChatId": "当前对话 ID",
"Current time": "当前时间",
"Histories": "最近 10 条聊天记录",
"Histories": "历史记录",
"Key already exists": "Key 已经存在",
"Key cannot be empty": "参数名不能为空",
"Props name": "参数名",
@@ -1331,6 +1332,7 @@
},
"textarea_variable_picker_tip": "输入 / 可选择变量",
"unusable_variable": "无可用变量",
"upload_file_error": "上传文件失败",
"user": {
"Account": "账号",
"Amount of earnings": "收益(¥)",

View File

@@ -1,9 +1,10 @@
{
"bucket_chat": "对话文件",
"bucket_file": "知识库文件",
"click_to_view_raw_source": "点击查看来源",
"release_the_mouse_to_upload_the_file": "松开鼠标上传文件",
"upload_error_description": "单次只支持上传多个文件或者一个文件夹",
"file_name": "文件名",
"file_size": "文件大小",
"release_the_mouse_to_upload_the_file": "松开鼠标上传文件",
"select_and_drag_file_tip": "点击或拖动文件到此处上传",
"select_file_amount_limit": "最多选择 {{max}} 个文件",
"some_file_count_exceeds_limit": "超出 {{maxCount}} 个文件,已自动截取",
@@ -12,5 +13,6 @@
"support_max_count": "最多支持 {{maxCount}} 个文件",
"support_max_size": "单个文件最大 {{maxSize}}",
"upload_failed": "上传异常",
"reached_max_file_count": "已达到最大文件数量"
"reached_max_file_count": "已达到最大文件数量",
"upload_error_description": "单次只支持上传多个文件或者一个文件夹"
}

View File

@@ -25,7 +25,19 @@
"Code log": "Log 日志",
"Custom inputs": "自定义输入",
"Custom outputs": "自定义输出",
"Error": "错误信息"
"Error": "错误信息",
"Read file result": "文档解析结果预览",
"read files": "解析的文档"
},
"template": {
"ai_chat": "AI 对话",
"ai_chat_intro": "AI 大模型对话",
"dataset_search": "知识库搜索",
"dataset_search_intro": "调用“语义检索”和“全文检索”能力,从“知识库”中查找可能与问题相关的参考内容",
"system_config": "系统配置",
"tool_call": "工具调用",
"tool_call_intro": "通过AI模型自动选择一个或多个功能块进行调用也可以对插件进行调用。",
"workflow_start": "流程开始"
},
"tool_input": "工具参数",
"variable_picker_tips": "可输入节点名或变量名搜索",