(feat:attach)state manage, follow camelCase

This commit is contained in:
ManishMadan2882
2025-06-06 18:54:50 +05:30
parent 3bae30c70c
commit 430822bae3
4 changed files with 18 additions and 6 deletions

View File

@@ -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) => {

View File

@@ -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>
))}

View File

@@ -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 {