Merge pull request #993 from SuanmoSuanyangTechnology/feature/memory_ui_zy
Feature/memory UI zy
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
<title>导出</title>
|
<title>导入</title>
|
||||||
<g id="空间里层页面优化" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round">
|
<g id="空间里层页面优化" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round">
|
||||||
<g id="记忆库-个人记忆-感知记忆-文本" transform="translate(-573, -158)" stroke="#171719">
|
<g id="记忆库-个人记忆-感知记忆-文本" transform="translate(-555, -158)" stroke="#171719">
|
||||||
<g id="导出" transform="translate(573, 158)">
|
<g id="导入" transform="translate(555, 158)">
|
||||||
<g id="编组-54" transform="translate(3, 3)">
|
<g id="编组-54" transform="translate(3, 3)">
|
||||||
<path d="M10,6 L10,7.5 C10,8.88071187 8.88071187,10 7.5,10 L2.5,10 C1.11928813,10 0,8.88071187 0,7.5 L0,6 L0,6" id="路径"></path>
|
<path d="M10,6 L10,7.5 C10,8.88071187 8.88071187,10 7.5,10 L2.5,10 C1.11928813,10 0,8.88071187 0,7.5 L0,6 L0,6" id="路径"></path>
|
||||||
<g id="编组-11" transform="translate(2, 0)">
|
<g id="编组-11" transform="translate(5, 3.4982) scale(1, -1) translate(-5, -3.4982)translate(2, 0)">
|
||||||
<line x1="3" y1="0.08499952" x2="3" y2="6.99635859" id="路径-24"></line>
|
<line x1="3" y1="0.08499952" x2="3" y2="6.99635859" id="路径-24"></line>
|
||||||
<polyline id="路径-25" stroke-linejoin="round" points="0 3 2.98005548 6.08298138e-18 6 3"></polyline>
|
<polyline id="路径-25" stroke-linejoin="round" points="0 3 2.98005548 6.08298138e-18 6 3"></polyline>
|
||||||
</g>
|
</g>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
@@ -1,12 +1,12 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
<title>导入</title>
|
<title>导出</title>
|
||||||
<g id="空间里层页面优化" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round">
|
<g id="空间里层页面优化" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round">
|
||||||
<g id="记忆库-个人记忆-感知记忆-文本" transform="translate(-555, -158)" stroke="#171719">
|
<g id="记忆库-个人记忆-感知记忆-文本" transform="translate(-573, -158)" stroke="#171719">
|
||||||
<g id="导入" transform="translate(555, 158)">
|
<g id="导出" transform="translate(573, 158)">
|
||||||
<g id="编组-54" transform="translate(3, 3)">
|
<g id="编组-54" transform="translate(3, 3)">
|
||||||
<path d="M10,6 L10,7.5 C10,8.88071187 8.88071187,10 7.5,10 L2.5,10 C1.11928813,10 0,8.88071187 0,7.5 L0,6 L0,6" id="路径"></path>
|
<path d="M10,6 L10,7.5 C10,8.88071187 8.88071187,10 7.5,10 L2.5,10 C1.11928813,10 0,8.88071187 0,7.5 L0,6 L0,6" id="路径"></path>
|
||||||
<g id="编组-11" transform="translate(5, 3.4982) scale(1, -1) translate(-5, -3.4982)translate(2, 0)">
|
<g id="编组-11" transform="translate(2, 0)">
|
||||||
<line x1="3" y1="0.08499952" x2="3" y2="6.99635859" id="路径-24"></line>
|
<line x1="3" y1="0.08499952" x2="3" y2="6.99635859" id="路径-24"></line>
|
||||||
<polyline id="路径-25" stroke-linejoin="round" points="0 3 2.98005548 6.08298138e-18 6 3"></polyline>
|
<polyline id="路径-25" stroke-linejoin="round" points="0 3 2.98005548 6.08298138e-18 6 3"></polyline>
|
||||||
</g>
|
</g>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
@@ -272,14 +272,21 @@ const ChatContent: FC<ChatContentProps> = ({
|
|||||||
<Flex vertical gap={4} className="rb:mt-1! rb:pt-3! rb-border-t rb:mb-2!">
|
<Flex vertical gap={4} className="rb:mt-1! rb:pt-3! rb-border-t rb:mb-2!">
|
||||||
<div className="rb:font-medium">{t('memoryConversation.citations')}</div>
|
<div className="rb:font-medium">{t('memoryConversation.citations')}</div>
|
||||||
{item.meta_data?.citations?.map((citation, idx) => (
|
{item.meta_data?.citations?.map((citation, idx) => (
|
||||||
<div
|
<Flex key={idx} align="center" gap={12}>
|
||||||
key={idx}
|
<div
|
||||||
className="rb:text-[#155EEF] rb:leading-5 rb:underline rb:cursor-pointer"
|
className="rb:text-[#155EEF] rb:leading-5 rb:underline rb:cursor-pointer"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
const params = new URLSearchParams({ documentId: citation.document_id, parentId: citation.knowledge_id });
|
const params = new URLSearchParams({ documentId: citation.document_id, parentId: citation.knowledge_id });
|
||||||
window.open(`/#/knowledge-base/${citation.knowledge_id}/DocumentDetails?${params}`, '_blank');
|
window.open(`/#/knowledge-base/${citation.knowledge_id}/DocumentDetails?${params}`, '_blank');
|
||||||
}}
|
}}
|
||||||
>{citation.file_name}</div>
|
>{citation.file_name}</div>
|
||||||
|
|
||||||
|
{citation.download_url &&
|
||||||
|
<div className="rb:size-4 rb:cursor-pointer rb:bg-cover rb:bg-[url('@/assets/images/application/export.svg')]"
|
||||||
|
onClick={() => handleDownload({ url: citation.download_url })}
|
||||||
|
></div>
|
||||||
|
}
|
||||||
|
</Flex>
|
||||||
))}
|
))}
|
||||||
</Flex>
|
</Flex>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ export interface ChatItem {
|
|||||||
subContent?: Record<string, any>[];
|
subContent?: Record<string, any>[];
|
||||||
error?: string;
|
error?: string;
|
||||||
meta_data?: {
|
meta_data?: {
|
||||||
audio_url?: string;
|
audio_url?: string | null;
|
||||||
audio_status?: string;
|
audio_status?: string;
|
||||||
files?: any[];
|
files?: any[];
|
||||||
suggested_questions?: string[];
|
suggested_questions?: string[];
|
||||||
@@ -33,6 +33,7 @@ export interface ChatItem {
|
|||||||
file_name: string;
|
file_name: string;
|
||||||
knowledge_id: string;
|
knowledge_id: string;
|
||||||
score: string;
|
score: string;
|
||||||
|
download_url?: string;
|
||||||
}[];
|
}[];
|
||||||
reasoning_content?: string;
|
reasoning_content?: string;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1460,6 +1460,7 @@ export const en = {
|
|||||||
maxCount: 'Max Files',
|
maxCount: 'Max Files',
|
||||||
singleMaxSize: 'Max Size',
|
singleMaxSize: 'Max Size',
|
||||||
unix: 'items',
|
unix: 'items',
|
||||||
|
document_image_recognition: 'Enable image recognition in documents',
|
||||||
text_to_speech: 'Text to Speech',
|
text_to_speech: 'Text to Speech',
|
||||||
text_to_speech_desc: 'Text can be converted to speech',
|
text_to_speech_desc: 'Text can be converted to speech',
|
||||||
opening_statement: 'Conversation Opening',
|
opening_statement: 'Conversation Opening',
|
||||||
@@ -1469,6 +1470,7 @@ export const en = {
|
|||||||
add_questions: 'Add Option',
|
add_questions: 'Add Option',
|
||||||
citation: 'Citation and Attribution',
|
citation: 'Citation and Attribution',
|
||||||
citation_desc: 'Display the attribution of source documents and generated content',
|
citation_desc: 'Display the attribution of source documents and generated content',
|
||||||
|
allow_download: 'Allow downloading cited source text',
|
||||||
invalidVariablesTitle: "The following undefined variables are referenced in the conversation opening. Do you want to save the opening configuration?",
|
invalidVariablesTitle: "The following undefined variables are referenced in the conversation opening. Do you want to save the opening configuration?",
|
||||||
deep_thinking: 'Enable Deep Thinking',
|
deep_thinking: 'Enable Deep Thinking',
|
||||||
|
|
||||||
@@ -1536,6 +1538,7 @@ export const en = {
|
|||||||
json_output: 'Support JSON formatted output',
|
json_output: 'Support JSON formatted output',
|
||||||
thinking_budget_tokens: 'thinking budget tokens',
|
thinking_budget_tokens: 'thinking budget tokens',
|
||||||
thinking_budget_tokens_max_error: "Cannot exceed the max tokens limit ({{max}})",
|
thinking_budget_tokens_max_error: "Cannot exceed the max tokens limit ({{max}})",
|
||||||
|
logSearchPlaceholder: 'Search log content',
|
||||||
},
|
},
|
||||||
userMemory: {
|
userMemory: {
|
||||||
userMemory: 'User Memory',
|
userMemory: 'User Memory',
|
||||||
@@ -2529,6 +2532,7 @@ Memory Bear: After the rebellion, regional warlordism intensified for several re
|
|||||||
|
|
||||||
input_result: 'Input',
|
input_result: 'Input',
|
||||||
output_result: 'Output',
|
output_result: 'Output',
|
||||||
|
process_result: 'Data Processing',
|
||||||
error: 'Error Message',
|
error: 'Error Message',
|
||||||
loopNum: ' loops',
|
loopNum: ' loops',
|
||||||
iterationNum: ' iterations',
|
iterationNum: ' iterations',
|
||||||
|
|||||||
@@ -790,6 +790,7 @@ export const zh = {
|
|||||||
maxCount: '最大文件数',
|
maxCount: '最大文件数',
|
||||||
singleMaxSize: '单文件最大大小',
|
singleMaxSize: '单文件最大大小',
|
||||||
unix: '个',
|
unix: '个',
|
||||||
|
document_image_recognition: '是否识别文档中的图片',
|
||||||
text_to_speech: '文字转语音',
|
text_to_speech: '文字转语音',
|
||||||
text_to_speech_desc: '文本可以转换成语音',
|
text_to_speech_desc: '文本可以转换成语音',
|
||||||
opening_statement: '对话开场白',
|
opening_statement: '对话开场白',
|
||||||
@@ -799,6 +800,7 @@ export const zh = {
|
|||||||
add_questions: '添加选项',
|
add_questions: '添加选项',
|
||||||
citation: '引用和归属',
|
citation: '引用和归属',
|
||||||
citation_desc: '显示源文档和生成内容的归属部分',
|
citation_desc: '显示源文档和生成内容的归属部分',
|
||||||
|
allow_download: '允许下载引用原文',
|
||||||
invalidVariablesTitle: "对话开场白中引用了以下未定义的变量,是否保存开场白配置?",
|
invalidVariablesTitle: "对话开场白中引用了以下未定义的变量,是否保存开场白配置?",
|
||||||
deep_thinking: '开启深度思考',
|
deep_thinking: '开启深度思考',
|
||||||
|
|
||||||
@@ -866,6 +868,7 @@ export const zh = {
|
|||||||
json_output: '支持JSON格式化输出',
|
json_output: '支持JSON格式化输出',
|
||||||
thinking_budget_tokens: '深度思考预算Token数',
|
thinking_budget_tokens: '深度思考预算Token数',
|
||||||
thinking_budget_tokens_max_error: "不能超过 最大令牌数 ({{max}})",
|
thinking_budget_tokens_max_error: "不能超过 最大令牌数 ({{max}})",
|
||||||
|
logSearchPlaceholder: '搜索日志内容',
|
||||||
},
|
},
|
||||||
table: {
|
table: {
|
||||||
totalRecords: '共 {{total}} 条记录'
|
totalRecords: '共 {{total}} 条记录'
|
||||||
@@ -2493,6 +2496,7 @@ export const zh = {
|
|||||||
|
|
||||||
input_result: '输入',
|
input_result: '输入',
|
||||||
output_result: '输出',
|
output_result: '输出',
|
||||||
|
process_result: '数据处理',
|
||||||
error: '错误信息',
|
error: '错误信息',
|
||||||
loopNum: '个循环',
|
loopNum: '个循环',
|
||||||
iterationNum: '个迭代',
|
iterationNum: '个迭代',
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
import { useEffect, useRef, useState, forwardRef, useImperativeHandle, useMemo } from 'react';
|
import { useEffect, useRef, useState, forwardRef, useImperativeHandle, useMemo } from 'react';
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { useParams } from 'react-router-dom';
|
import { useParams } from 'react-router-dom';
|
||||||
import { Row, Col, Space, Form, Input, Button, App, Spin, Flex } from 'antd'
|
import { Row, Col, Space, Form, Input, Button, App, Flex } from 'antd'
|
||||||
|
|
||||||
import Chat from './components/Chat'
|
import Chat from './components/Chat'
|
||||||
import RbCard from '@/components/RbCard/Card'
|
import RbCard from '@/components/RbCard/Card'
|
||||||
@@ -357,21 +357,23 @@ const Agent = forwardRef<AgentRef, { onFeaturesLoad?: (features: FeaturesConfigF
|
|||||||
const { statement = '' } = value?.opening_statement || {}
|
const { statement = '' } = value?.opening_statement || {}
|
||||||
onFeaturesLoad?.(value)
|
onFeaturesLoad?.(value)
|
||||||
|
|
||||||
const usedVars = [...new Set([...(statement?.matchAll(/\{\{(\w+)\}\}/g) ?? [])].map(m => m[1]))]
|
if (value?.opening_statement?.enabled) {
|
||||||
const variables = values?.variables
|
const usedVars = [...new Set([...(statement?.matchAll(/\{\{(\w+)\}\}/g) ?? [])].map(m => m[1]))]
|
||||||
const validNames = new Set(variables.map(v => v.name))
|
const variables = values?.variables
|
||||||
const invalid = usedVars.filter(v => !validNames.has(v))
|
const validNames = new Set(variables.map(v => v.name))
|
||||||
if (invalid.length > 0) {
|
const invalid = usedVars.filter(v => !validNames.has(v))
|
||||||
const newVars = invalid.map((name, i) => ({
|
if (invalid.length > 0) {
|
||||||
index: variables.length + i,
|
const newVars = invalid.map((name, i) => ({
|
||||||
name,
|
index: variables.length + i,
|
||||||
display_name: name,
|
name,
|
||||||
type: 'text',
|
display_name: name,
|
||||||
required: true,
|
type: 'text',
|
||||||
max_length: 48,
|
required: true,
|
||||||
}))
|
max_length: 48,
|
||||||
|
}))
|
||||||
|
|
||||||
form.setFieldValue('variables', [...variables, ...newVars])
|
form.setFieldValue('variables', [...variables, ...newVars])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const modelLogo = useMemo(() => {
|
const modelLogo = useMemo(() => {
|
||||||
|
|||||||
@@ -155,6 +155,12 @@ const FeaturesConfigModal = forwardRef<FeaturesConfigModalRef, FeaturesConfigMod
|
|||||||
name={['citation', "enabled"]}
|
name={['citation', "enabled"]}
|
||||||
desc={t('application.citation_desc')}
|
desc={t('application.citation_desc')}
|
||||||
/>
|
/>
|
||||||
|
<SwitchFormItem
|
||||||
|
title={t(`application.allow_download`)}
|
||||||
|
name={['citation', "allow_download"]}
|
||||||
|
disabled={!values?.citation?.enabled}
|
||||||
|
className="rb:mt-2!"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="rb:relative rb:border rb:border-[#DFE4ED] rb:p-3 rb:rounded-lg rb:bg-[#f5f7fc]">
|
<div className="rb:relative rb:border rb:border-[#DFE4ED] rb:p-3 rb:rounded-lg rb:bg-[#f5f7fc]">
|
||||||
|
|||||||
@@ -97,6 +97,7 @@ export const defaultValues: FileUpload = {
|
|||||||
"json",
|
"json",
|
||||||
"md",
|
"md",
|
||||||
],
|
],
|
||||||
|
document_image_recognition: false,
|
||||||
video_enabled: false,
|
video_enabled: false,
|
||||||
video_max_size_mb: 100,
|
video_max_size_mb: 100,
|
||||||
video_allowed_extensions: [
|
video_allowed_extensions: [
|
||||||
@@ -219,11 +220,22 @@ const FileUploadSettingModal = forwardRef<FileUploadSettingModalRef, FileUploadS
|
|||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
{isEnabled && (
|
{isEnabled && (
|
||||||
<Flex align="center" gap={12} className="rb:mt-3! rb:pt-3! rb:border-t rb:border-[#DFE4ED]">
|
<Flex align="center" gap={16} className="rb:mt-3! rb:pt-3! rb:border-t rb:border-[#DFE4ED]">
|
||||||
<div>{t('application.singleMaxSize')}: </div>
|
<div>
|
||||||
<Form.Item name={sizeKey} noStyle>
|
<div>{t('application.singleMaxSize')}</div>
|
||||||
<InputNumber min={1} max={100} suffix="MB" className="rb:flex-1" />
|
<Form.Item name={sizeKey} noStyle>
|
||||||
</Form.Item>
|
<InputNumber min={1} max={100} suffix="MB" className="rb:flex-1" />
|
||||||
|
</Form.Item>
|
||||||
|
</div>
|
||||||
|
{option.type === 'document' &&
|
||||||
|
<div>
|
||||||
|
<div>{t('application.document_image_recognition')}</div>
|
||||||
|
<Form.Item name="document_image_recognition" valuePropName="checked" noStyle>
|
||||||
|
<Switch className="rb:mt-1.5!" />
|
||||||
|
</Form.Item>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
<Form.Item name={`${option.type}_allowed_extensions`} hidden />
|
<Form.Item name={`${option.type}_allowed_extensions`} hidden />
|
||||||
</Flex>
|
</Flex>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ const OpenStatementSettingModal = forwardRef<OpenStatementSettingModalRef, OpenS
|
|||||||
<Form.Item
|
<Form.Item
|
||||||
label={t('application.opening_statement')}
|
label={t('application.opening_statement')}
|
||||||
name="statement"
|
name="statement"
|
||||||
|
rules={[{ required: true, message: t('common.pleaseEnter') }]}
|
||||||
>
|
>
|
||||||
{source === 'workflow'
|
{source === 'workflow'
|
||||||
? <Editor options={chatVariables as any} variant="outlined" />
|
? <Editor options={chatVariables as any} variant="outlined" />
|
||||||
|
|||||||
@@ -184,7 +184,8 @@ const ModelConfigModal = forwardRef<ModelConfigModalRef, ModelConfigModalProps>(
|
|||||||
{
|
{
|
||||||
validator: (_, value) => {
|
validator: (_, value) => {
|
||||||
const maxTokens = values?.max_tokens
|
const maxTokens = values?.max_tokens
|
||||||
if (value !== undefined && maxTokens !== undefined && value > maxTokens) {
|
const deep_thinking = values?.deep_thinking;
|
||||||
|
if (deep_thinking && value !== undefined && maxTokens !== undefined && value > maxTokens) {
|
||||||
return Promise.reject(t('application.thinking_budget_tokens_max_error', { max: maxTokens }))
|
return Promise.reject(t('application.thinking_budget_tokens_max_error', { max: maxTokens }))
|
||||||
}
|
}
|
||||||
return Promise.resolve()
|
return Promise.resolve()
|
||||||
|
|||||||
@@ -438,6 +438,7 @@ interface FileSetttings {
|
|||||||
document_enabled: boolean;
|
document_enabled: boolean;
|
||||||
document_max_size_mb: number;
|
document_max_size_mb: number;
|
||||||
document_allowed_extensions: string[];
|
document_allowed_extensions: string[];
|
||||||
|
document_image_recognition: boolean;
|
||||||
video_enabled: boolean;
|
video_enabled: boolean;
|
||||||
video_max_size_mb: number;
|
video_max_size_mb: number;
|
||||||
video_allowed_extensions: string[];
|
video_allowed_extensions: string[];
|
||||||
@@ -499,6 +500,7 @@ export interface LogItem {
|
|||||||
is_draft: boolean;
|
is_draft: boolean;
|
||||||
created_at: number;
|
created_at: number;
|
||||||
updated_at: number;
|
updated_at: number;
|
||||||
|
node_executions_map?: Record<string, ChatItem['subContent']>
|
||||||
}
|
}
|
||||||
export interface LogDetailModalRef {
|
export interface LogDetailModalRef {
|
||||||
handleOpen: (vo: LogItem) => void;
|
handleOpen: (vo: LogItem) => void;
|
||||||
|
|||||||
@@ -56,6 +56,8 @@ const NODE_VARIABLES = {
|
|||||||
],
|
],
|
||||||
'document-extractor': [
|
'document-extractor': [
|
||||||
{ label: 'text', dataType: 'string', field: 'text' },
|
{ label: 'text', dataType: 'string', field: 'text' },
|
||||||
|
// { label: 'chunks', dataType: 'array[string]', field: 'chunks' },
|
||||||
|
{ label: 'images', dataType: 'array[file]', field: 'images' },
|
||||||
],
|
],
|
||||||
'list-operator': [
|
'list-operator': [
|
||||||
{ label: 'result', dataType: 'array[string]', field: 'result' },
|
{ label: 'result', dataType: 'array[string]', field: 'result' },
|
||||||
|
|||||||
Reference in New Issue
Block a user