feat(web): app citation features add allow_download
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,22 @@ 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 align="center" gap={12}>
|
||||||
key={idx}
|
<div
|
||||||
className="rb:text-[#155EEF] rb:leading-5 rb:underline rb:cursor-pointer"
|
key={idx}
|
||||||
onClick={() => {
|
className="rb:text-[#155EEF] rb:leading-5 rb:underline rb:cursor-pointer"
|
||||||
const params = new URLSearchParams({ documentId: citation.document_id, parentId: citation.knowledge_id });
|
onClick={() => {
|
||||||
window.open(`/#/knowledge-base/${citation.knowledge_id}/DocumentDetails?${params}`, '_blank');
|
const params = new URLSearchParams({ documentId: citation.document_id, parentId: citation.knowledge_id });
|
||||||
}}
|
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;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1470,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',
|
||||||
|
|
||||||
|
|||||||
@@ -800,6 +800,7 @@ export const zh = {
|
|||||||
add_questions: '添加选项',
|
add_questions: '添加选项',
|
||||||
citation: '引用和归属',
|
citation: '引用和归属',
|
||||||
citation_desc: '显示源文档和生成内容的归属部分',
|
citation_desc: '显示源文档和生成内容的归属部分',
|
||||||
|
allow_download: '允许下载引用原文',
|
||||||
invalidVariablesTitle: "对话开场白中引用了以下未定义的变量,是否保存开场白配置?",
|
invalidVariablesTitle: "对话开场白中引用了以下未定义的变量,是否保存开场白配置?",
|
||||||
deep_thinking: '开启深度思考',
|
deep_thinking: '开启深度思考',
|
||||||
|
|
||||||
|
|||||||
@@ -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]">
|
||||||
|
|||||||
Reference in New Issue
Block a user