mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-14 01:15:51 +08:00
parent
4150805073
commit
44d798d8f0
@ -17,7 +17,7 @@
|
|||||||
.chunkText();
|
.chunkText();
|
||||||
padding: 0 14px;
|
padding: 0 14px;
|
||||||
background-color: rgba(249, 250, 251, 1);
|
background-color: rgba(249, 250, 251, 1);
|
||||||
word-break: break-all;
|
word-break: break-word;
|
||||||
}
|
}
|
||||||
.messageTextBase() {
|
.messageTextBase() {
|
||||||
padding: 6px 10px;
|
padding: 6px 10px;
|
||||||
@ -30,20 +30,20 @@
|
|||||||
.chunkText();
|
.chunkText();
|
||||||
.messageTextBase();
|
.messageTextBase();
|
||||||
background-color: #e6f4ff;
|
background-color: #e6f4ff;
|
||||||
word-break: break-all;
|
word-break: break-word;
|
||||||
}
|
}
|
||||||
.messageTextDark {
|
.messageTextDark {
|
||||||
.chunkText();
|
.chunkText();
|
||||||
.messageTextBase();
|
.messageTextBase();
|
||||||
background-color: #1668dc;
|
background-color: #1668dc;
|
||||||
word-break: break-all;
|
word-break: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
.messageUserText {
|
.messageUserText {
|
||||||
.chunkText();
|
.chunkText();
|
||||||
.messageTextBase();
|
.messageTextBase();
|
||||||
background-color: rgba(255, 255, 255, 0.3);
|
background-color: rgba(255, 255, 255, 0.3);
|
||||||
word-break: break-all;
|
word-break: break-word;
|
||||||
text-align: justify;
|
text-align: justify;
|
||||||
}
|
}
|
||||||
.messageEmpty {
|
.messageEmpty {
|
||||||
|
@ -28,9 +28,10 @@ interface IProps extends Partial<IRemoveMessageById>, IRegenerateMessage {
|
|||||||
reference: IReference;
|
reference: IReference;
|
||||||
loading?: boolean;
|
loading?: boolean;
|
||||||
sendLoading?: boolean;
|
sendLoading?: boolean;
|
||||||
|
visibleAvatar?: boolean;
|
||||||
nickname?: string;
|
nickname?: string;
|
||||||
avatar?: string;
|
avatar?: string;
|
||||||
avatardialog?: string | null;
|
avatarDialog?: string | null;
|
||||||
clickDocumentButton?: (documentId: string, chunk: IReferenceChunk) => void;
|
clickDocumentButton?: (documentId: string, chunk: IReferenceChunk) => void;
|
||||||
index: number;
|
index: number;
|
||||||
showLikeButton?: boolean;
|
showLikeButton?: boolean;
|
||||||
@ -42,7 +43,7 @@ const MessageItem = ({
|
|||||||
reference,
|
reference,
|
||||||
loading = false,
|
loading = false,
|
||||||
avatar,
|
avatar,
|
||||||
avatardialog,
|
avatarDialog,
|
||||||
sendLoading = false,
|
sendLoading = false,
|
||||||
clickDocumentButton,
|
clickDocumentButton,
|
||||||
index,
|
index,
|
||||||
@ -50,6 +51,7 @@ const MessageItem = ({
|
|||||||
regenerateMessage,
|
regenerateMessage,
|
||||||
showLikeButton = true,
|
showLikeButton = true,
|
||||||
showLoudspeaker = true,
|
showLoudspeaker = true,
|
||||||
|
visibleAvatar = true,
|
||||||
}: IProps) => {
|
}: IProps) => {
|
||||||
const { theme } = useTheme();
|
const { theme } = useTheme();
|
||||||
const isAssistant = item.role === MessageType.Assistant;
|
const isAssistant = item.role === MessageType.Assistant;
|
||||||
@ -105,13 +107,15 @@ const MessageItem = ({
|
|||||||
[styles.messageItemContentReverse]: item.role === MessageType.User,
|
[styles.messageItemContentReverse]: item.role === MessageType.User,
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
{item.role === MessageType.User ? (
|
{visibleAvatar &&
|
||||||
<Avatar size={40} src={avatar ?? '/logo.svg'} />
|
(item.role === MessageType.User ? (
|
||||||
) : avatardialog ? (
|
<Avatar size={40} src={avatar ?? '/logo.svg'} />
|
||||||
<Avatar size={40} src={avatardialog} />
|
) : avatarDialog ? (
|
||||||
) : (
|
<Avatar size={40} src={avatarDialog} />
|
||||||
<AssistantIcon />
|
) : (
|
||||||
)}
|
<AssistantIcon />
|
||||||
|
))}
|
||||||
|
|
||||||
<Flex vertical gap={8} flex={1}>
|
<Flex vertical gap={8} flex={1}>
|
||||||
<Space>
|
<Space>
|
||||||
{isAssistant ? (
|
{isAssistant ? (
|
||||||
|
@ -69,7 +69,7 @@ const ChatContainer = ({ controller }: IProps) => {
|
|||||||
item={message}
|
item={message}
|
||||||
nickname={userInfo.nickname}
|
nickname={userInfo.nickname}
|
||||||
avatar={userInfo.avatar}
|
avatar={userInfo.avatar}
|
||||||
avatardialog={conversation.avatar}
|
avatarDialog={conversation.avatar}
|
||||||
reference={buildMessageItemReference(
|
reference={buildMessageItemReference(
|
||||||
{
|
{
|
||||||
message: derivedMessages,
|
message: derivedMessages,
|
||||||
|
@ -4,7 +4,7 @@ import { useClickDrawer } from '@/components/pdf-drawer/hooks';
|
|||||||
import { MessageType, SharedFrom } from '@/constants/chat';
|
import { MessageType, SharedFrom } from '@/constants/chat';
|
||||||
import { useSendButtonDisabled } from '@/pages/chat/hooks';
|
import { useSendButtonDisabled } from '@/pages/chat/hooks';
|
||||||
import { Flex, Spin } from 'antd';
|
import { Flex, Spin } from 'antd';
|
||||||
import { forwardRef, useMemo } from 'react';
|
import React, { forwardRef, useMemo } from 'react';
|
||||||
import {
|
import {
|
||||||
useGetSharedChatSearchParams,
|
useGetSharedChatSearchParams,
|
||||||
useSendSharedMessage,
|
useSendSharedMessage,
|
||||||
@ -14,11 +14,17 @@ import { buildMessageItemReference } from '../utils';
|
|||||||
import PdfDrawer from '@/components/pdf-drawer';
|
import PdfDrawer from '@/components/pdf-drawer';
|
||||||
import { useFetchNextConversationSSE } from '@/hooks/chat-hooks';
|
import { useFetchNextConversationSSE } from '@/hooks/chat-hooks';
|
||||||
import { useFetchFlowSSE } from '@/hooks/flow-hooks';
|
import { useFetchFlowSSE } from '@/hooks/flow-hooks';
|
||||||
|
import i18n from '@/locales/config';
|
||||||
import { buildMessageUuidWithRole } from '@/utils/chat';
|
import { buildMessageUuidWithRole } from '@/utils/chat';
|
||||||
import styles from './index.less';
|
import styles from './index.less';
|
||||||
|
|
||||||
const ChatContainer = () => {
|
const ChatContainer = () => {
|
||||||
const { sharedId: conversationId, from } = useGetSharedChatSearchParams();
|
const {
|
||||||
|
sharedId: conversationId,
|
||||||
|
from,
|
||||||
|
locale,
|
||||||
|
visibleAvatar,
|
||||||
|
} = useGetSharedChatSearchParams();
|
||||||
const { visible, hideModal, documentId, selectedChunk, clickDocumentButton } =
|
const { visible, hideModal, documentId, selectedChunk, clickDocumentButton } =
|
||||||
useClickDrawer();
|
useClickDrawer();
|
||||||
|
|
||||||
@ -39,7 +45,11 @@ const ChatContainer = () => {
|
|||||||
? useFetchFlowSSE
|
? useFetchFlowSSE
|
||||||
: useFetchNextConversationSSE;
|
: useFetchNextConversationSSE;
|
||||||
}, [from]);
|
}, [from]);
|
||||||
|
React.useEffect(() => {
|
||||||
|
if (locale && i18n.language !== locale) {
|
||||||
|
i18n.changeLanguage(locale);
|
||||||
|
}
|
||||||
|
}, [locale, visibleAvatar]);
|
||||||
const { data: avatarData } = useFetchAvatar();
|
const { data: avatarData } = useFetchAvatar();
|
||||||
|
|
||||||
if (!conversationId) {
|
if (!conversationId) {
|
||||||
@ -55,8 +65,9 @@ const ChatContainer = () => {
|
|||||||
{derivedMessages?.map((message, i) => {
|
{derivedMessages?.map((message, i) => {
|
||||||
return (
|
return (
|
||||||
<MessageItem
|
<MessageItem
|
||||||
|
visibleAvatar={visibleAvatar}
|
||||||
key={buildMessageUuidWithRole(message)}
|
key={buildMessageUuidWithRole(message)}
|
||||||
avatardialog={avatarData?.avatar}
|
avatarDialog={avatarData?.avatar}
|
||||||
item={message}
|
item={message}
|
||||||
nickname="You"
|
nickname="You"
|
||||||
reference={buildMessageItemReference(
|
reference={buildMessageItemReference(
|
||||||
|
@ -26,6 +26,10 @@ export const useGetSharedChatSearchParams = () => {
|
|||||||
return {
|
return {
|
||||||
from: searchParams.get('from') as SharedFrom,
|
from: searchParams.get('from') as SharedFrom,
|
||||||
sharedId: searchParams.get('shared_id'),
|
sharedId: searchParams.get('shared_id'),
|
||||||
|
locale: searchParams.get('locale'),
|
||||||
|
visibleAvatar: searchParams.get('visible_avatar')
|
||||||
|
? searchParams.get('visible_avatar') !== '1'
|
||||||
|
: true,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ const FlowChatBox = () => {
|
|||||||
useGetFileIcon();
|
useGetFileIcon();
|
||||||
const { t } = useTranslate('chat');
|
const { t } = useTranslate('chat');
|
||||||
const { data: userInfo } = useFetchUserInfo();
|
const { data: userInfo } = useFetchUserInfo();
|
||||||
const { data: cavasInfo } = useFetchFlow();
|
const { data: canvasInfo } = useFetchFlow();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -50,7 +50,7 @@ const FlowChatBox = () => {
|
|||||||
key={buildMessageUuidWithRole(message)}
|
key={buildMessageUuidWithRole(message)}
|
||||||
nickname={userInfo.nickname}
|
nickname={userInfo.nickname}
|
||||||
avatar={userInfo.avatar}
|
avatar={userInfo.avatar}
|
||||||
avatardialog={cavasInfo.avatar}
|
avatarDialog={canvasInfo.avatar}
|
||||||
item={message}
|
item={message}
|
||||||
reference={buildMessageItemReference(
|
reference={buildMessageItemReference(
|
||||||
{ message: derivedMessages, reference },
|
{ message: derivedMessages, reference },
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
|
import { RAGFlowNodeType } from '@/interfaces/database/flow';
|
||||||
import { DefaultOptionType } from 'antd/es/select';
|
import { DefaultOptionType } from 'antd/es/select';
|
||||||
import get from 'lodash/get';
|
import get from 'lodash/get';
|
||||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
import { BeginId, Operator } from '../constant';
|
import { BeginId, Operator } from '../constant';
|
||||||
import { BeginQuery, RAGFlowNodeType } from '../interface';
|
import { BeginQuery } from '../interface';
|
||||||
import useGraphStore from '../store';
|
import useGraphStore from '../store';
|
||||||
|
|
||||||
export const useGetBeginNodeDataQuery = () => {
|
export const useGetBeginNodeDataQuery = () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user