Skip to content

Commit 9c8d261

Browse files
Merge pull request #38 from boostcampwm-2024/feature/#36-AI_QA_해결
Feature/#36 ai qa 해결
2 parents f4a4bc1 + 9326df4 commit 9c8d261

File tree

13 files changed

+783
-542
lines changed

13 files changed

+783
-542
lines changed

@noctaCrdt/src/types/Interfaces.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ export type PageIconType =
6262
// 협업 관련
6363
| "Team" // 팀 문서
6464
| "Shared" // 공유 문서
65-
| "Feedback"; // 피드백/리뷰
65+
| "Feedback" // 피드백/리뷰
66+
| "AI";
6667

6768
export type TextColorType = Exclude<BackgroundColorType, "transparent">;
6869

client/src/apis/ai.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@ import { unAuthorizationFetch } from "./axios";
44
// TODO 실패 시 예외처리
55
export const useCreateAIDocumentMutation = (onSuccess: () => void) => {
66
const fetcher = ({
7+
socketId,
78
clientId,
89
workspaceId,
910
message,
1011
}: {
12+
socketId: string;
1113
clientId: number | null;
1214
workspaceId: string | undefined;
1315
message: string;
14-
}) => unAuthorizationFetch.post("/ai/chat", { clientId, workspaceId, message });
16+
}) => unAuthorizationFetch.post("/ai/chat", { socketId, clientId, workspaceId, message });
1517

1618
return useMutation({
1719
mutationFn: fetcher,

client/src/constants/PageIconButton.config.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ import {
2525
// 협업 관련
2626
RiGroupLine, // team: 팀 문서
2727
RiDiscussLine, // feedback: 피드백
28-
RiAddFill, // plus: 추가
28+
RiAddFill,
29+
RiRobot2Line, // plus: 추가
2930
} from "react-icons/ri";
3031

3132
export interface IconConfig {
@@ -108,6 +109,11 @@ export const iconComponents: Record<PageIconType | "plus", IconConfig> = {
108109
icon: RiAddFill,
109110
color: "#2B4158",
110111
},
112+
113+
AI: {
114+
icon: RiRobot2Line,
115+
color: "#6a00f4",
116+
},
111117
};
112118

113119
export const iconGroups = [

client/src/features/ai/AIModal.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ export const AIModal = ({ onCloseButton }: { onCloseButton: () => void }) => {
1313
const [message, setMessage] = useState("");
1414
const { mutate: createAIDocument, status } = useCreateAIDocumentMutation(onCloseButton);
1515
const isLoading = status === "pending";
16+
const { getSocketId } = useSocketStore();
17+
const socketId = getSocketId() || "";
1618

1719
const { addToast } = useToastStore();
1820
const handleSubmit = () => {
@@ -21,7 +23,7 @@ export const AIModal = ({ onCloseButton }: { onCloseButton: () => void }) => {
2123
return;
2224
}
2325
if (!isLoading) {
24-
createAIDocument({ clientId, workspaceId: workspace?.id, message });
26+
createAIDocument({ socketId, clientId, workspaceId: workspace?.id, message });
2527
}
2628
};
2729

0 commit comments

Comments
 (0)