How dhwjdgh1122/writing-demo works
This is a Korean sentence-correction web demo: users select text, request correction candidates, compare changes, optionally read explanations, and apply a candidate. The browser also supports reruns, local correction history, and optional activity logging/export. The server validates correction and explanation requests, delegates model work through a provider interface, and currently supports Gemini. The graph reflects the sampled imports and calls plus README-documented behavior; the browser-to-server HTTP connection is shown as unverified because the API implementation excerpt was not provided.
Main entry points: App.tsx Workspace app · gemini.ts Gemini adapter · app.ts API server · CandidateCard.tsx Candidate card
Components 27
Writing workspace
- Workspace app
client/src/App.tsx - Editor state
client/src/state/editor.ts - Browser API
client/src/lib/api.ts - Candidate results
client/src/components/CorrectionResults.tsx - Candidate card
client/src/components/CandidateCard.tsx - Rerun controls
client/src/components/RerunControls.tsx - Selection helpers
client/src/lib/selectionAnchor.ts - Text reveal
client/src/lib/revealTextRange.ts
Local records
- History hook
client/src/hooks/useHistory.ts - History panel
client/src/components/HistoryPanel.tsx - Correction history
client/src/lib/history.ts - Activity hook
client/src/hooks/useActivity.ts - Activity panel
client/src/components/ActivityPanel.tsx - Activity controller
client/src/lib/activity.ts - Browser storage
Correction service
- API server
server/app.ts - Provider contract
server/llm/provider.ts - Provider config
server/llm/config.ts - Gemini adapter
server/llm/gemini.ts - Model prompts
server/llm/prompt.ts - Explanation parsing
server/llm/parse-explanations.ts
Shared domain logic
- Request contracts
shared/contracts.ts - Explanation changes
shared/explanation-changes.ts - Expression diff
shared/expression-diff.ts - Display diff
client/src/lib/diff.ts
Other components
- Writer
- Gemini API
Connections 31
- Writer → Workspace app: uses
README.md - Workspace app → Editor state: updates
client/src/App.tsx - Workspace app → Browser API: requests correction
client/src/App.tsx - Workspace app → Candidate results: renders
client/src/App.tsx - Workspace app → Rerun controls: renders
client/src/App.tsx - Workspace app → Selection helpers: uses
client/src/App.tsx - Workspace app → Text reveal: uses
client/src/App.tsx - Workspace app → History hook: uses
client/src/App.tsx - Workspace app → Activity hook: uses
client/src/App.tsx - Candidate results → Browser API: requests explanations
client/src/components/CorrectionResults.tsx - Candidate results → Candidate card: renders
client/src/components/CorrectionResults.tsx - Candidate card → Display diff: uses
client/src/components/CandidateCard.tsx - Candidate card → Explanation changes: uses
client/src/components/CandidateCard.tsx - History hook → Correction history: uses
client/src/hooks/useHistory.ts - History panel → Correction history: reads
client/src/components/HistoryPanel.tsx - History panel → Candidate card: renders
client/src/components/HistoryPanel.tsx - Activity hook → Activity controller: creates controller
client/src/hooks/useActivity.ts - Activity panel → Activity hook: uses
client/src/components/ActivityPanel.tsx - Activity controller → Correction history: reads records
client/src/lib/activity.ts - Activity hook → Browser storage: reads and writes
client/src/hooks/useActivity.ts - Browser API → API server: sends HTTP requests
- API server → Request contracts: validates requests
server/app.ts - API server → Provider contract: delegates generation
server/app.ts - API server → Gemini adapter: uses configured provider
- Provider config → Provider contract: configures
server/llm/config.ts - Provider config → Gemini adapter: configures
server/llm/config.ts - Gemini adapter → Model prompts: builds prompts
server/llm/gemini.ts - Gemini adapter → Explanation parsing: parses explanations
server/llm/gemini.ts - Gemini adapter → Explanation changes: adds change data
server/llm/gemini.ts - Gemini adapter → Gemini API: calls model
README.md - Explanation changes → Expression diff: groups expressions
shared/explanation-changes.ts