690615:1449 237 #01
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
# ADR-037: Unified Prompt Management UX/UI
|
||||
|
||||
**Status:** Draft
|
||||
**Status:** Implemented
|
||||
**Date:** 2026-06-14
|
||||
**Last Updated:** 2026-06-15
|
||||
**Decision Makers:** Development Team, System Architect
|
||||
**Supersedes:** ADR-029: Dynamic Prompt Management (extends prompt_type scope)
|
||||
**Related Documents:**
|
||||
@@ -59,7 +60,7 @@ ADR-029 กำหนด architecture สำหรับ prompt management (ai_pr
|
||||
| # | ประเด็น | การตัดสินใจ |
|
||||
|---|---------|-------------|
|
||||
| 1 | Prompt Type Scope | รองรับ 4 types: ocr_extraction, rag_query_prompt, rag_prep_prompt, classification_prompt |
|
||||
| 2 | Sandbox Workflow | Hybrid flow: OCR → Extract → Optional Review → RAG Prep |
|
||||
| 2 | Sandbox Workflow | Required 3-step flow: OCR → Extract → RAG Prep |
|
||||
| 3 | UX/UI Layout | Single Page พร้อม Prompt Type Dropdown |
|
||||
| 4 | Context Config UI | View/Edit/Save/Apply ครบถ้วน |
|
||||
| 5 | Runtime Parameters UI | แยกจาก Context Config UI ชัดเจน |
|
||||
@@ -163,12 +164,23 @@ VALUES ('classification_prompt', 1, '<template for document classification>',
|
||||
```
|
||||
|
||||
**Components:**
|
||||
- **PromptTypeDropdown:** เลือก prompt_type (ocr_extraction, rag_query_prompt, rag_prep_prompt, classification_prompt)
|
||||
- **VersionHistory:** แสดง versions ของ prompt_type ที่เลือก (แยกตาม type)
|
||||
- **PromptEditor:** Textarea สำหรับแก้ prompt template (validate `{{ocr_text}}` หรือ placeholders อื่นๆ)
|
||||
- **PromptTypeDropdown:** เลือก prompt_type (ocr_extraction, rag_query_prompt, rag_prep_prompt, classification_prompt, All Types)
|
||||
- **VersionHistory:** แสดง versions ของ prompt_type ที่เลือก (แยกตาม type) หรือทุก types (All Types view)
|
||||
- **PromptEditor:** Textarea สำหรับแก้ prompt template (validate placeholders ตาม prompt type)
|
||||
- **ContextConfigEditor:** Form สำหรับ edit context_config (projectId, contractId, pageSize, language)
|
||||
- **SandboxTabs:** Tabs สำหรับทดสอบแต่ละ step (OCR, Extract, RAG Prep)
|
||||
- **RuntimeParametersPanel:** Sliders สำหรับ runtime parameters (temperature, topP, repeatPenalty, ฯลฯ) - แยกจาก Context Config
|
||||
- **SandboxTabs:** Tabs สำหรับทดสอบแต่ละ step (OCR, Extract, RAG Prep - required)
|
||||
- **RuntimeParametersPanel:** Sliders สำหรับ runtime parameters (temperature, topP, repeatPenalty, ฯลฯ) - แยกจาก Context Config, label: "Runtime Parameters (Global - Applies to All AI Jobs)"
|
||||
|
||||
**Responsive Design:**
|
||||
- **Desktop (>1024px):** 2-column layout (Left Panel 50%, Right Panel 50%)
|
||||
- **Tablet (768px-1024px):** 2-column layout (Left Panel 40%, Right Panel 60%)
|
||||
- **Mobile (<768px):** Stack panels vertically (Left Panel collapsible accordion on top, Right Panel full width below, Sandbox full width below Editor)
|
||||
|
||||
**Context Config Field Validation:**
|
||||
- **Project Filter:** Optional, UUID (publicId), must exist in projects table
|
||||
- **Contract Filter:** Optional, UUID (publicId), must exist in contracts table
|
||||
- **Page Size:** Optional, integer, min=1, max=1000, default=null (process all pages)
|
||||
- **Language:** Optional, enum (TH, EN, MIXED), default=MIXED
|
||||
|
||||
### 4. Sandbox Workflow (Hybrid Flow)
|
||||
|
||||
@@ -191,9 +203,9 @@ Admin Select Prompt Version
|
||||
→ Structured metadata (JSON)
|
||||
```
|
||||
|
||||
**Step 3: RAG Prep (Optional)**
|
||||
**Step 3: RAG Prep (Required)**
|
||||
```
|
||||
Admin Click "Test RAG Prep" (optional)
|
||||
Admin Click "Test RAG Prep" (required)
|
||||
→ POST /api/ai/admin/sandbox/rag-prep
|
||||
→ BullMQ (ai-realtime) job type: "sandbox-rag-prep"
|
||||
→ OllamaService → typhoon2.5-np-dms (Semantic Chunking)
|
||||
@@ -296,9 +308,9 @@ Q4: Context config ใช้ที่ไหน → ทั้ง sandbox แล
|
||||
Q5: Context config เก็บที่ไหน → A (ใน ai_prompts per version)
|
||||
Q6: ปัญหา UX ละเอียด → 6.1 Version ไม่แยก OCR/AI, 6.2 2-step flow ไม่เหมือ production, 6.3 Context config UI ขาด
|
||||
Q7: Prompt type รองรับอะไร → D (ocr_extraction, rag_query_prompt, rag_prep_prompt, classification_prompt)
|
||||
Q8: Sandbox workflow เพิ่มอะไร → A (RAG Prep step)
|
||||
Q8: Sandbox workflow เพิ่มอะไร → A (RAG Prep step - required)
|
||||
Q9: UX layout อย่างไร → A (Single Page พร้อม Dropdown + ส่งต่อผลลัพธ์)
|
||||
Q10: Sandbox workflow อย่างไร → C (Hybrid: OCR → Extract → Optional Review → RAG Prep)
|
||||
Q10: Sandbox workflow อย่างไร → A (Required 3-step: OCR → Extract → RAG Prep)
|
||||
Q11: ขัดแย้ง ADR-029 → สร้าง ADR ใหม่ supersede
|
||||
Q12: ขัดแย้ง ADR-027 → ไม่ขัดแย้ง (single page ยังใช้ได้)
|
||||
Q13: ขัดแย้ง ADR-036 → ไม่ขัดแย้ง (runtime vs context แยก concern)
|
||||
|
||||
Reference in New Issue
Block a user