mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-13 18:36:01 +08:00
fix: fixed the problem that the api will be called directly after selecting the chat assistant picture (#1034)
### What problem does this PR solve? fix: fixed the problem that the api will be called directly after selecting the chat assistant picture #1033 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
cc064040a2
commit
9517a27844
@ -31,6 +31,7 @@ def set_dialog():
|
|||||||
req = request.json
|
req = request.json
|
||||||
dialog_id = req.get("dialog_id")
|
dialog_id = req.get("dialog_id")
|
||||||
name = req.get("name", "New Dialog")
|
name = req.get("name", "New Dialog")
|
||||||
|
icon = req.get("icon", "")
|
||||||
description = req.get("description", "A helpful Dialog")
|
description = req.get("description", "A helpful Dialog")
|
||||||
top_n = req.get("top_n", 6)
|
top_n = req.get("top_n", 6)
|
||||||
top_k = req.get("top_k", 1024)
|
top_k = req.get("top_k", 1024)
|
||||||
@ -90,7 +91,8 @@ def set_dialog():
|
|||||||
"top_k": top_k,
|
"top_k": top_k,
|
||||||
"rerank_id": rerank_id,
|
"rerank_id": rerank_id,
|
||||||
"similarity_threshold": similarity_threshold,
|
"similarity_threshold": similarity_threshold,
|
||||||
"vector_similarity_weight": vector_similarity_weight
|
"vector_similarity_weight": vector_similarity_weight,
|
||||||
|
"icon": icon,
|
||||||
}
|
}
|
||||||
if not DialogService.save(**dia):
|
if not DialogService.save(**dia):
|
||||||
return get_data_error_result(retmsg="Fail to new a dialog!")
|
return get_data_error_result(retmsg="Fail to new a dialog!")
|
||||||
|
@ -25,11 +25,9 @@ const AssistantSetting = ({ show }: ISegmentedContentProps) => {
|
|||||||
const uploadButtion = (
|
const uploadButtion = (
|
||||||
<button style={{ border: 0, background: 'none' }} type="button">
|
<button style={{ border: 0, background: 'none' }} type="button">
|
||||||
<PlusOutlined />
|
<PlusOutlined />
|
||||||
<div style={{ marginTop: 8 }}>
|
<div style={{ marginTop: 8 }}>{t('upload', { keyPrefix: 'common' })}</div>
|
||||||
{t('upload', { keyPrefix: 'common' })}
|
|
||||||
</div>
|
|
||||||
</button>
|
</button>
|
||||||
)
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section
|
<section
|
||||||
@ -53,6 +51,7 @@ const AssistantSetting = ({ show }: ISegmentedContentProps) => {
|
|||||||
<Upload
|
<Upload
|
||||||
listType="picture-card"
|
listType="picture-card"
|
||||||
maxCount={1}
|
maxCount={1}
|
||||||
|
beforeUpload={() => false}
|
||||||
showUploadList={{ showPreviewIcon: false, showRemoveIcon: false }}
|
showUploadList={{ showPreviewIcon: false, showRemoveIcon: false }}
|
||||||
>
|
>
|
||||||
{show ? uploadButtion : null}
|
{show ? uploadButtion : null}
|
||||||
|
@ -19,6 +19,7 @@ import ModelSetting from './model-setting';
|
|||||||
import PromptEngine from './prompt-engine';
|
import PromptEngine from './prompt-engine';
|
||||||
|
|
||||||
import { useTranslate } from '@/hooks/commonHooks';
|
import { useTranslate } from '@/hooks/commonHooks';
|
||||||
|
import { getBase64FromUploadFileList } from '@/utils/fileUtil';
|
||||||
import styles from './index.less';
|
import styles from './index.less';
|
||||||
|
|
||||||
const layout = {
|
const layout = {
|
||||||
@ -82,12 +83,7 @@ const ChatConfigurationModal = ({
|
|||||||
]);
|
]);
|
||||||
const emptyResponse = nextValues.prompt_config?.empty_response ?? '';
|
const emptyResponse = nextValues.prompt_config?.empty_response ?? '';
|
||||||
|
|
||||||
const fileList = values.icon;
|
const icon = await getBase64FromUploadFileList(values.icon);
|
||||||
let icon;
|
|
||||||
|
|
||||||
if (Array.isArray(fileList) && fileList.length > 0) {
|
|
||||||
icon = fileList[0].thumbUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
const finalValues = {
|
const finalValues = {
|
||||||
dialog_id: initialDialog.id,
|
dialog_id: initialDialog.id,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user