mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-11-29 16:43:16 +00:00
(feat:attach)state manage, follow camelCase
This commit is contained in:
@@ -267,7 +267,7 @@ class GetSingleConversation(Resource):
|
||||
if attachment:
|
||||
attachment_details.append({
|
||||
"id": str(attachment["_id"]),
|
||||
"filename": attachment.get("filename", "Unknown file")
|
||||
"fileName": attachment.get("filename", "Unknown file")
|
||||
})
|
||||
except Exception as e:
|
||||
current_app.logger.error(
|
||||
|
||||
@@ -27,6 +27,7 @@ import {
|
||||
setConversation,
|
||||
updateConversationId,
|
||||
updateQuery,
|
||||
selectAttachments,
|
||||
} from './conversationSlice';
|
||||
|
||||
export default function Conversation() {
|
||||
@@ -39,6 +40,7 @@ export default function Conversation() {
|
||||
const status = useSelector(selectStatus);
|
||||
const conversationId = useSelector(selectConversationId);
|
||||
const selectedAgent = useSelector(selectSelectedAgent);
|
||||
const attachments = useSelector(selectAttachments);
|
||||
|
||||
const [uploadModalState, setUploadModalState] =
|
||||
useState<ActiveState>('INACTIVE');
|
||||
@@ -107,15 +109,25 @@ export default function Conversation() {
|
||||
const trimmedQuestion = question.trim();
|
||||
if (trimmedQuestion === '') return;
|
||||
|
||||
const attachmentMetadata = attachments
|
||||
.filter((a) => a.id && a.status === 'completed')
|
||||
.map((a) => ({ id: a.id as string, fileName: a.fileName }));
|
||||
|
||||
if (index !== undefined) {
|
||||
if (!isRetry) dispatch(resendQuery({ index, prompt: trimmedQuestion }));
|
||||
handleFetchAnswer({ question: trimmedQuestion, index });
|
||||
} else {
|
||||
if (!isRetry) dispatch(addQuery({ prompt: trimmedQuestion }));
|
||||
if (!isRetry)
|
||||
dispatch(
|
||||
addQuery({
|
||||
prompt: trimmedQuestion,
|
||||
attachments: attachmentMetadata,
|
||||
}),
|
||||
);
|
||||
handleFetchAnswer({ question: trimmedQuestion, index });
|
||||
}
|
||||
},
|
||||
[dispatch, handleFetchAnswer],
|
||||
[dispatch, handleFetchAnswer, attachments],
|
||||
);
|
||||
|
||||
const handleFeedback = (query: Query, feedback: FEEDBACK, index: number) => {
|
||||
|
||||
@@ -59,7 +59,7 @@ const ConversationBubble = forwardRef<
|
||||
updated?: boolean,
|
||||
index?: number,
|
||||
) => void;
|
||||
attachmentsMetadata?: { id: string; filename: string }[];
|
||||
attachmentsMetadata?: { id: string; fileName: string }[];
|
||||
}
|
||||
>(function ConversationBubble(
|
||||
{
|
||||
@@ -124,7 +124,7 @@ const ConversationBubble = forwardRef<
|
||||
/>
|
||||
</div>
|
||||
<span className="max-w-[150px] truncate font-normal">
|
||||
{attachment.filename}
|
||||
{attachment.fileName}
|
||||
</span>
|
||||
</div>
|
||||
))}
|
||||
|
||||
@@ -46,7 +46,7 @@ export interface Query {
|
||||
sources?: { title: string; text: string; link: string }[];
|
||||
tool_calls?: ToolCallsType[];
|
||||
error?: string;
|
||||
attachments?: { id: string; filename: string }[];
|
||||
attachments?: { id: string; fileName: string }[];
|
||||
}
|
||||
|
||||
export interface RetrievalPayload {
|
||||
|
||||
Reference in New Issue
Block a user