fix: plugin select files and ai response check (#3104)

* fix: plugin select files and ai response check

* perf: text editor selector;tool call tip;remove invalid image url;

* perf: select file

* perf: drop files
This commit is contained in:
Archer
2024-11-09 14:43:15 +08:00
committed by GitHub
parent d58cf44778
commit 0d658c0114
28 changed files with 171 additions and 87 deletions

View File

@@ -1,4 +1,4 @@
import React, { useRef, useCallback, useState } from 'react';
import React, { useRef, useCallback, useState, useMemo } from 'react';
import { Button, useDisclosure, Box, Flex, useOutsideClick, Checkbox } from '@chakra-ui/react';
import { ListItemType, MultipleArraySelectProps, MultipleSelectProps } from './type';
import EmptyTip from '../EmptyTip';
@@ -177,6 +177,10 @@ export const MultipleRowArraySelect = ({
const [navigationPath, setNavigationPath] = useState<string[]>([]);
const formatValue = useMemo(() => {
return Array.isArray(value) ? value : [];
}, [value]);
// Close when clicking outside
useOutsideClick({
ref: ref,
@@ -198,7 +202,7 @@ export const MultipleRowArraySelect = ({
setNavigationPath(newPath);
} else {
const parentValue = navigationPath[0];
const newValues = [...value];
const newValues = [...formatValue];
const newValue = [parentValue, item.value];
if (newValues.some((v) => v[0] === parentValue && v[1] === item.value)) {
@@ -225,7 +229,7 @@ export const MultipleRowArraySelect = ({
const showCheckbox = !hasChildren;
const isChecked =
showCheckbox &&
value.some((v) => v[1] === item.value && v[0] === navigationPath[0]);
formatValue.some((v) => v[1] === item.value && v[0] === navigationPath[0]);
return (
<Flex
@@ -264,13 +268,13 @@ export const MultipleRowArraySelect = ({
</>
);
},
[navigationPath, value, onSelect]
[navigationPath, formatValue, onSelect]
);
const onOpenSelect = useCallback(() => {
setNavigationPath([]);
onOpen();
}, [value, onOpen]);
}, []);
return (
<Box ref={ref} position={'relative'}>

View File

@@ -1,5 +1,7 @@
{
"AI_input_is_empty": "The content passed to the AI node is empty",
"Delete_all": "Clear All Lexicon",
"LLM_model_response_empty": "The model flow response is empty, please check whether the model flow output is normal.",
"chat_history": "Conversation History",
"chat_input_guide_lexicon_is_empty": "Lexicon not configured yet",
"citations": "{{num}} References",
@@ -12,6 +14,7 @@
"contextual_preview": "Contextual Preview {{num}} Items",
"csv_input_lexicon_tip": "Only CSV batch import is supported, click to download the template",
"custom_input_guide_url": "Custom Lexicon URL",
"dataset_quote_type error": "Knowledge base reference type is wrong, correct type: { datasetId: string }[]",
"delete_all_input_guide_confirm": "Are you sure you want to clear the input guide lexicon?",
"empty_directory": "This directory is empty~",
"file_amount_over": "Exceeded maximum file quantity {{max}}",
@@ -32,12 +35,14 @@
"not_select_file": "No file selected",
"plugins_output": "Plugin Output",
"question_tip": "From top to bottom, the response order of each module",
"response.dataset_concat_length": "Combined total",
"response.node_inputs": "Node Inputs",
"select": "Select",
"select_file": "Upload File",
"select_file_img": "Upload file / image",
"select_img": "Upload Image",
"stream_output": "Stream Output",
"unsupported_file_type": "Unsupported file types",
"upload": "Upload",
"view_citations": "View References",
"web_site_sync": "Web Site Sync"

View File

@@ -131,7 +131,7 @@
"question_optimization": "Question Optimization",
"quote_content_placeholder": "The structure of the reference content can be customized to better suit different scenarios. \nSome variables can be used for template configuration\n\n{{q}} - main content\n\n{{a}} - auxiliary data\n\n{{source}} - source name\n\n{{sourceId}} - source ID\n\n{{index}} - nth reference",
"quote_content_tip": "The structure of the reference content can be customized to better suit different scenarios. Some variables can be used for template configuration:\n\n{{q}} - main content\n{{a}} - auxiliary data\n{{source}} - source name\n{{sourceId}} - source ID\n{{index}} - nth reference\nThey are all optional and the following are the default values:\n\n{{default}}",
"quote_num": "Quote {{num}}",
"quote_num": "Dataset",
"quote_prompt_tip": "You can use {{quote}} to insert a quote content template and {{question}} to insert a question (Role=user).\n\nThe following are the default values:\n\n{{default}}",
"quote_role_system_tip": "Please note that the {{question}} variable is removed from the \"Quote Template Prompt Words\"",
"quote_role_user_tip": "Please pay attention to adding the {{question}} variable in the \"Quote Template Prompt Word\"",

View File

@@ -1,5 +1,7 @@
{
"AI_input_is_empty": "传入AI 节点的内容为空",
"Delete_all": "清空词库",
"LLM_model_response_empty": "模型流响应为空,请检查模型流输出是否正常",
"chat_history": "聊天记录",
"chat_input_guide_lexicon_is_empty": "还没有配置词库",
"citations": "{{num}}条引用",
@@ -12,6 +14,7 @@
"contextual_preview": "上下文预览 {{num}} 条",
"csv_input_lexicon_tip": "仅支持 CSV 批量导入,点击下载模板",
"custom_input_guide_url": "自定义词库地址",
"dataset_quote_type error": "知识库引用类型错误,正确类型:{ datasetId: string }[]",
"delete_all_input_guide_confirm": "确定要清空输入引导词库吗?",
"empty_directory": "这个目录已经没东西可选了~",
"file_amount_over": "超出最大文件数量 {{max}}",
@@ -33,12 +36,14 @@
"plugins_output": "插件输出",
"question_tip": "从上到下,为各个模块的响应顺序",
"response.child total points": "子工作流积分消耗",
"response.dataset_concat_length": "合并后总数",
"response.node_inputs": "节点输入",
"select": "选择",
"select_file": "上传文件",
"select_file_img": "上传文件/图片",
"select_img": "上传图片",
"stream_output": "流输出",
"unsupported_file_type": "不支持的文件类型",
"upload": "上传",
"view_citations": "查看引用",
"web_site_sync": "Web站点同步"

View File

@@ -132,7 +132,7 @@
"question_optimization": "问题优化",
"quote_content_placeholder": "可以自定义引用内容的结构,以更好的适配不同场景。可以使用一些变量来进行模板配置\n{{q}} - 主要内容\n{{a}} - 辅助数据\n{{source}} - 来源名\n{{sourceId}} - 来源ID\n{{index}} - 第 n 个引用",
"quote_content_tip": "可以自定义引用内容的结构,以更好的适配不同场景。可以使用一些变量来进行模板配置\n{{q}} - 主要内容\n{{a}} - 辅助数据\n{{source}} - 来源名\n{{sourceId}} - 来源ID\n{{index}} - 第 n 个引用\n他们都是可选的下面是默认值\n{{default}}",
"quote_num": "引用{{num}}",
"quote_num": "引用",
"quote_prompt_tip": "可以用 {{quote}} 来插入引用内容模板,使用 {{question}} 来插入问题(Role=user)。\n下面是默认值\n{{default}}",
"quote_role_system_tip": "请注意从“引用模板提示词”中移除 {{question}} 变量",
"quote_role_user_tip": "请注意在“引用模板提示词”中添加 {{question}} 变量",