개요 : waai/data/{diary, ideas, bible, web_research, works} 에 정제된 데이터가 저장됩니다. 이 데이터들은 향후 기획서 생성 시 활용됩니다.

동작 로직

[ User : /home/username/memory/ 에 정제되지 않은데이터 저장]

↓

[ Data-Format-Bot : 파일 생성을 감지하면 waai-backend로 api/data/reformat-md API 호출 ]

↓

[ Waai-backend : 데이터 정제용 프롬프트를 활용해서 build_data_repair_prompt 함수 호출(프롬프트 포함) ]

↓

[ Ollama : qweb2.5-refine-ko 모델이 데이터 정제 후 응답 ]

↓

[ Waai-backend : validate_date_front_matter 함수에서 메타 데이터 유효성 검증 후 누락 발견 시 llm 재호출 ]

↓

[ Ollama : qweb2.5-refine-ko 모델이 데이터 재정제 후 응답 ]

↓

[ Waai-backend : 정제된 data 를 /home/username/waai/data/ 에 저장 ]

image.png

flowchart TB

%% -------- Swinlanes (Containers) --------
subgraph U[User]
direction TB
U1[Save raw data to memory directory]
end

subgraph DFB[Data-Format-Bot]
direction TB
DFB1[Detect new file]
DFB2[Call backend API data reformat]
end

subgraph WB[waai-backend]
direction TB
WB1[Receive reformat request]
WB2[Build data repair prompt]
WB3[Send LLM request to ollama]
WB4[Validate YAML front matter]
WB5{Metadata valid}
WB6[Rebuild prompt for retry]
WB7[Retry LLM request to ollama]
WB8[Save cleaned data to waai data directory]
end

subgraph OL[ollama]
direction TB
OL1[Generate cleaned markdown]
end

%% -------- Data reformat pipeline --------
U1 --> DFB1 --> DFB2 --> WB1
WB1 --> WB2 --> WB3 --> OL1
OL1 --> WB4 --> WB5
WB5 --> WB8
WB5 --> WB6 --> WB7 --> OL1