전 저장소 리팩터링과 SSOT 정비

This commit is contained in:
Yun Chan 2026-07-15 21:31:30 +09:00
parent 14ecbd4e7d
commit 3dfddcac6f
173 changed files with 19679 additions and 6952 deletions

View file

@ -197,6 +197,9 @@ export type PersonaDraftGenerateResponse = ApiSchema<"PersonaDraftGenerateRespon
/** POST /sessions — sessions.py SessionStartResponse */
export type SessionStartResponse = ApiSchema<"SessionStartResponse">;
/** P2 단계 누적 게이지·상세 수치 — session_read_model.SessionProgress */
export type SessionProgress = ApiSchema<"SessionProgress">;
export type SessionStageProgress = ApiSchema<"SessionStageProgress">;
/** POST /sessions/{id}/turn — sessions.py TurnResponse */
export type TurnResponse = ApiSchema<"TurnResponse">;
@ -279,6 +282,8 @@ export interface SessionStreamDone {
crisis_resource?: CrisisResource | null;
conversation_stopped?: boolean;
output_error?: string | null;
/** P2 단계 누적 게이지·상세 수치 */
progress?: SessionProgress | null;
}
function safeParse(data: string): unknown {
@ -348,6 +353,7 @@ export async function openSessionStream(
crisis_resource: parsed.crisis_resource,
conversation_stopped: parsed.conversation_stopped,
output_error: parsed.output_error,
progress: parsed.progress ?? null,
};
handlers.onDone?.(donePayload);
return;
@ -419,6 +425,25 @@ export const personaReviewApi = {
api.post<PersonaReviewSummary>("/personas/drafts", payload),
createSource: (payload: PersonaSourceDocumentRequest) =>
api.post<PersonaSourceDocumentResponse>("/personas/sources", payload),
/** P4: 자유 양식 엑셀/CSV 업로드 → 서버 변환·등록 (원본은 서버에 저장되지 않음) */
uploadSource: async (
file: File,
options: { source_kind?: string; title?: string; source_note?: string } = {},
) => {
const form = new FormData();
form.append("file", file);
if (options.source_kind) form.append("source_kind", options.source_kind);
if (options.title) form.append("title", options.title);
if (options.source_note) form.append("source_note", options.source_note);
const res = await fetch(joinUrl("/personas/sources/upload"), {
method: "POST",
credentials: "include",
headers: { Accept: "application/json" },
body: form,
});
if (!res.ok) throw await parseError(res);
return (await res.json()) as PersonaSourceDocumentResponse;
},
generateDraft: (payload: PersonaDraftGenerateRequest) =>
api.post<PersonaDraftGenerateResponse>("/personas/drafts/generate", payload),
getDraft: (personaId: string) =>
@ -464,8 +489,12 @@ export const sessionApi = {
},
get: (sessionId: string) =>
api.get<SessionDetailResponse>(`/sessions/${encodeURIComponent(sessionId)}`),
start: (persona_code: string, theory_mode: "humanistic" | "cbt" | "integrative" = "humanistic") =>
api.post<SessionStartResponse>("/sessions", { persona_code, theory_mode }),
start: (
persona_code: string,
theory_mode: "humanistic" | "cbt" | "integrative" = "humanistic",
goal_stages: SessionStage[] = [],
) =>
api.post<SessionStartResponse>("/sessions", { persona_code, theory_mode, goal_stages }),
turn: (sessionId: string, text: string) =>
api.post<TurnResponse>(`/sessions/${encodeURIComponent(sessionId)}/turn`, { text }),
liveCoach: (sessionId: string, payload: LiveCoachRequest) =>