# choohongwook/ai-poc-test architecture

> Architecture diagram of the GitHub repository choohongwook/ai-poc-test, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/choohongwook/ai-poc-test
- Repository: https://github.com/choohongwook/ai-poc-test

## Overview

AI Document Generation POC is a web application for configuring AI providers and prompts, generating structured outputs, analyzing uploaded files, and exploring large-file/RAG workflows. The primary flow is the home page collecting configuration and input, calling the generation client, then showing outputs and history. Separate routes support regular and chunked file analysis, RAG document ingestion/query, and provider-key checks. Several routes and client helpers are represented from the SOURCE INDEX; their internal behavior was not sampled, so uncertain links are omitted.

Main entry points: [`app/page.tsx`](https://github.com/choohongwook/ai-poc-test/blob/main/app/page.tsx) (Generation Workspace), [`app/upload-test/page.tsx`](https://github.com/choohongwook/ai-poc-test/blob/main/app/upload-test/page.tsx) (File Analysis UI), [`app/api/upload-analyze/route.ts`](https://github.com/choohongwook/ai-poc-test/blob/main/app/api/upload-analyze/route.ts) (Regular Analysis Route), [`app/api/upload-analyze-large/rag/query/route.ts`](https://github.com/choohongwook/ai-poc-test/blob/main/app/api/upload-analyze-large/rag/query/route.ts) (RAG Query Route)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_generation["Generation UI"]
  node_home["Generation Workspace<br/>[page.tsx]"]
  node_configuration["AI Configuration"]
  node_schema["Schema Builder<br/>[SchemaSection.tsx]"]
  node_prompts["Prompt Editors"]
  node_input["Input and Files"]
  node_output["Output and History"]
  node_history["History View<br/>[page.tsx]"]
end

subgraph group_analysis["File Analysis"]
  node_upload_ui["File Analysis UI<br/>[page.tsx]"]
  node_upload_client["Upload Analysis Client<br/>[upload-analyze.ts]"]
  node_upload_route["Regular Analysis Route<br/>[route.ts]"]
  node_large_ui["Large File UI<br/>[page.tsx]"]
  node_large_client["Large Upload Client"]
  node_large_upload["Chunk Upload Route<br/>[route.ts]"]
  node_large_analyze["Map Reduce Analysis<br/>[route.ts]"]
end

subgraph group_rag["RAG Workflows"]
  node_rag_ui["RAG Workspace<br/>[page.tsx]"]
  node_rag_panels["RAG Panels<br/>[ChatPanel.tsx]"]
  node_rag_client["RAG API Client<br/>[rag.ts]"]
  node_rag_ingest["Document Ingestion Route<br/>[route.ts]"]
  node_rag_query["RAG Query Route<br/>[route.ts]"]
  node_rag_documents["Document Listing Route<br/>[route.ts]"]
end

subgraph group_providers["Provider Setup"]
  node_settings["Provider Settings<br/>[page.tsx]"]
  node_provider_card["Provider Configuration<br/>[ProviderCard.tsx]"]
  node_key_route["Key Validation Routes<br/>[route.ts]"]
  node_key_batch["Batch Key Adapters<br/>[_batch-adapters.ts]"]
end

subgraph group_runtime["AI Runtime"]
  node_generate_client["Generation Client<br/>[generate.ts]"]
  node_generate_route["Generation Route<br/>[route.ts]"]
  node_vector_store[("Vector Store<br/>[vector-store.ts]")]
  node_document_loader["Document Loader<br/>[document-loader.ts]"]
  node_analysis_chain["Analysis Chain<br/>[analysis-chain.ts]"]
  node_provider_factory["AI Provider Factory"]
  node_embedding_factory["Embedding Factory"]
  node_rag_chain["RAG Chain<br/>[rag-chain.ts]"]
  node_schema_converter["Schema Converter"]
end

node_user(("User"))

node_user -->|"configures and submits"| node_home
node_home -->|"renders"| node_configuration
node_home -->|"renders"| node_schema
node_home -->|"renders"| node_prompts
node_home -->|"renders"| node_input
node_home -->|"renders"| node_output
node_home -->|"calls"| node_generate_client
node_home -.->|"shares history with"| node_history
node_generate_route -->|"imports"| node_provider_factory
node_upload_ui -->|"renders"| node_configuration
node_upload_ui -->|"renders"| node_schema
node_upload_ui -->|"renders"| node_prompts
node_upload_ui -->|"calls"| node_upload_client
node_upload_route -->|"loads documents"| node_document_loader
node_upload_route -->|"runs analysis"| node_analysis_chain
node_upload_route -->|"creates providers"| node_provider_factory
node_upload_route -->|"converts schema"| node_schema_converter
node_large_ui -->|"calls"| node_large_client
node_large_analyze -->|"creates providers"| node_provider_factory
node_large_analyze -->|"converts schema"| node_schema_converter
node_rag_ui -->|"renders"| node_rag_panels
node_rag_ui -->|"uses"| node_rag_client
node_rag_ingest -->|"loads documents"| node_document_loader
node_rag_ingest -->|"creates embeddings"| node_embedding_factory
node_rag_ingest -->|"ingests into"| node_vector_store
node_rag_query -->|"creates embeddings"| node_embedding_factory
node_rag_query -->|"searches"| node_vector_store
node_rag_query -->|"runs query chain"| node_rag_chain
node_rag_query -->|"creates providers"| node_provider_factory
node_rag_documents -->|"reads documents"| node_vector_store
node_vector_store -->|"creates embeddings"| node_embedding_factory
node_settings -->|"renders"| node_provider_card
node_key_route -->|"uses adapters"| node_key_batch

click node_home "https://github.com/choohongwook/ai-poc-test/blob/main/app/page.tsx"
click node_configuration "https://github.com/choohongwook/ai-poc-test/blob/main/app/(main)/_components/ConfigurationPanel.tsx"
click node_schema "https://github.com/choohongwook/ai-poc-test/blob/main/app/(main)/_components/SchemaSection.tsx"
click node_prompts "https://github.com/choohongwook/ai-poc-test/blob/main/app/(main)/_components/SystemPromptSection.tsx"
click node_input "https://github.com/choohongwook/ai-poc-test/blob/main/app/(main)/_components/InputDataSection.tsx"
click node_output "https://github.com/choohongwook/ai-poc-test/blob/main/app/(main)/_components/OutputDataSection.tsx"
click node_history "https://github.com/choohongwook/ai-poc-test/blob/main/app/history/page.tsx"
click node_generate_client "https://github.com/choohongwook/ai-poc-test/blob/main/lib/api/generate.ts"
click node_generate_route "https://github.com/choohongwook/ai-poc-test/blob/main/app/api/generate/route.ts"
click node_upload_ui "https://github.com/choohongwook/ai-poc-test/blob/main/app/upload-test/page.tsx"
click node_upload_client "https://github.com/choohongwook/ai-poc-test/blob/main/lib/api/upload-analyze.ts"
click node_upload_route "https://github.com/choohongwook/ai-poc-test/blob/main/app/api/upload-analyze/route.ts"
click node_large_ui "https://github.com/choohongwook/ai-poc-test/blob/main/app/upload-test-large/files-api/page.tsx"
click node_large_client "https://github.com/choohongwook/ai-poc-test/blob/main/lib/api/upload-analyze-large.ts"
click node_large_upload "https://github.com/choohongwook/ai-poc-test/blob/main/app/api/upload-analyze-large/upload/route.ts"
click node_large_analyze "https://github.com/choohongwook/ai-poc-test/blob/main/app/api/upload-analyze-large/analyze/route.ts"
click node_rag_ui "https://github.com/choohongwook/ai-poc-test/blob/main/app/upload-test-large/rag/page.tsx"
click node_rag_panels "https://github.com/choohongwook/ai-poc-test/blob/main/app/upload-test-large/rag/_components/ChatPanel.tsx"
click node_rag_client "https://github.com/choohongwook/ai-poc-test/blob/main/lib/api/rag.ts"
click node_rag_ingest "https://github.com/choohongwook/ai-poc-test/blob/main/app/api/upload-analyze-large/rag/ingest/route.ts"
click node_rag_query "https://github.com/choohongwook/ai-poc-test/blob/main/app/api/upload-analyze-large/rag/query/route.ts"
click node_rag_documents "https://github.com/choohongwook/ai-poc-test/blob/main/app/api/upload-analyze-large/rag/documents/route.ts"
click node_vector_store "https://github.com/choohongwook/ai-poc-test/blob/main/lib/langchain/vector-store.ts"
click node_document_loader "https://github.com/choohongwook/ai-poc-test/blob/main/lib/langchain/document-loader.ts"
click node_analysis_chain "https://github.com/choohongwook/ai-poc-test/blob/main/lib/langchain/analysis-chain.ts"
click node_provider_factory "https://github.com/choohongwook/ai-poc-test/blob/main/lib/langchain/ai-provider-factory.ts"
click node_embedding_factory "https://github.com/choohongwook/ai-poc-test/blob/main/lib/langchain/embedding-factory.ts"
click node_rag_chain "https://github.com/choohongwook/ai-poc-test/blob/main/lib/langchain/rag-chain.ts"
click node_schema_converter "https://github.com/choohongwook/ai-poc-test/blob/main/lib/langchain/schema-converter.ts"
click node_settings "https://github.com/choohongwook/ai-poc-test/blob/main/app/settings/page.tsx"
click node_provider_card "https://github.com/choohongwook/ai-poc-test/blob/main/app/settings/_components/ProviderCard.tsx"
click node_key_route "https://github.com/choohongwook/ai-poc-test/blob/main/app/api/test-key/route.ts"
click node_key_batch "https://github.com/choohongwook/ai-poc-test/blob/main/app/api/test-key/_batch-adapters.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_home,node_configuration,node_schema,node_prompts,node_input,node_output,node_history,node_user toneBlue
class node_upload_ui,node_upload_client,node_upload_route,node_large_ui,node_large_client,node_large_upload,node_large_analyze toneAmber
class node_rag_ui,node_rag_panels,node_rag_client,node_rag_ingest,node_rag_query,node_rag_documents toneMint
class node_settings,node_provider_card,node_key_route,node_key_batch toneRose
class node_generate_client,node_generate_route,node_vector_store,node_document_loader,node_analysis_chain,node_provider_factory,node_embedding_factory,node_rag_chain,node_schema_converter toneIndigo
```

## Components

### Generation UI

- [Generation Workspace](https://github.com/choohongwook/ai-poc-test/blob/main/app/page.tsx): `app/page.tsx`
- [AI Configuration](https://github.com/choohongwook/ai-poc-test/blob/main/app/(main)/_components/ConfigurationPanel.tsx): `app/(main)/_components/ConfigurationPanel.tsx`
- [Schema Builder](https://github.com/choohongwook/ai-poc-test/blob/main/app/(main)/_components/SchemaSection.tsx): `app/(main)/_components/SchemaSection.tsx`
- [Prompt Editors](https://github.com/choohongwook/ai-poc-test/blob/main/app/(main)/_components/SystemPromptSection.tsx): `app/(main)/_components/SystemPromptSection.tsx`
- [Input and Files](https://github.com/choohongwook/ai-poc-test/blob/main/app/(main)/_components/InputDataSection.tsx): `app/(main)/_components/InputDataSection.tsx`
- [Output and History](https://github.com/choohongwook/ai-poc-test/blob/main/app/(main)/_components/OutputDataSection.tsx): `app/(main)/_components/OutputDataSection.tsx`
- [History View](https://github.com/choohongwook/ai-poc-test/blob/main/app/history/page.tsx): `app/history/page.tsx`

### File Analysis

- [File Analysis UI](https://github.com/choohongwook/ai-poc-test/blob/main/app/upload-test/page.tsx): `app/upload-test/page.tsx`
- [Upload Analysis Client](https://github.com/choohongwook/ai-poc-test/blob/main/lib/api/upload-analyze.ts): `lib/api/upload-analyze.ts`
- [Regular Analysis Route](https://github.com/choohongwook/ai-poc-test/blob/main/app/api/upload-analyze/route.ts): `app/api/upload-analyze/route.ts`
- [Large File UI](https://github.com/choohongwook/ai-poc-test/blob/main/app/upload-test-large/files-api/page.tsx): `app/upload-test-large/files-api/page.tsx`
- [Large Upload Client](https://github.com/choohongwook/ai-poc-test/blob/main/lib/api/upload-analyze-large.ts): `lib/api/upload-analyze-large.ts`
- [Chunk Upload Route](https://github.com/choohongwook/ai-poc-test/blob/main/app/api/upload-analyze-large/upload/route.ts): `app/api/upload-analyze-large/upload/route.ts`
- [Map Reduce Analysis](https://github.com/choohongwook/ai-poc-test/blob/main/app/api/upload-analyze-large/analyze/route.ts): `app/api/upload-analyze-large/analyze/route.ts`

### RAG Workflows

- [RAG Workspace](https://github.com/choohongwook/ai-poc-test/blob/main/app/upload-test-large/rag/page.tsx): `app/upload-test-large/rag/page.tsx`
- [RAG Panels](https://github.com/choohongwook/ai-poc-test/blob/main/app/upload-test-large/rag/_components/ChatPanel.tsx): `app/upload-test-large/rag/_components/ChatPanel.tsx`
- [RAG API Client](https://github.com/choohongwook/ai-poc-test/blob/main/lib/api/rag.ts): `lib/api/rag.ts`
- [Document Ingestion Route](https://github.com/choohongwook/ai-poc-test/blob/main/app/api/upload-analyze-large/rag/ingest/route.ts): `app/api/upload-analyze-large/rag/ingest/route.ts`
- [RAG Query Route](https://github.com/choohongwook/ai-poc-test/blob/main/app/api/upload-analyze-large/rag/query/route.ts): `app/api/upload-analyze-large/rag/query/route.ts`
- [Document Listing Route](https://github.com/choohongwook/ai-poc-test/blob/main/app/api/upload-analyze-large/rag/documents/route.ts): `app/api/upload-analyze-large/rag/documents/route.ts`

### Provider Setup

- [Provider Settings](https://github.com/choohongwook/ai-poc-test/blob/main/app/settings/page.tsx): `app/settings/page.tsx`
- [Provider Configuration](https://github.com/choohongwook/ai-poc-test/blob/main/app/settings/_components/ProviderCard.tsx): `app/settings/_components/ProviderCard.tsx`
- [Key Validation Routes](https://github.com/choohongwook/ai-poc-test/blob/main/app/api/test-key/route.ts): `app/api/test-key/route.ts`
- [Batch Key Adapters](https://github.com/choohongwook/ai-poc-test/blob/main/app/api/test-key/_batch-adapters.ts): `app/api/test-key/_batch-adapters.ts`

### AI Runtime

- [Generation Client](https://github.com/choohongwook/ai-poc-test/blob/main/lib/api/generate.ts): `lib/api/generate.ts`
- [Generation Route](https://github.com/choohongwook/ai-poc-test/blob/main/app/api/generate/route.ts): `app/api/generate/route.ts`
- [Vector Store](https://github.com/choohongwook/ai-poc-test/blob/main/lib/langchain/vector-store.ts): `lib/langchain/vector-store.ts`
- [Document Loader](https://github.com/choohongwook/ai-poc-test/blob/main/lib/langchain/document-loader.ts): `lib/langchain/document-loader.ts`
- [Analysis Chain](https://github.com/choohongwook/ai-poc-test/blob/main/lib/langchain/analysis-chain.ts): `lib/langchain/analysis-chain.ts`
- [AI Provider Factory](https://github.com/choohongwook/ai-poc-test/blob/main/lib/langchain/ai-provider-factory.ts): `lib/langchain/ai-provider-factory.ts`
- [Embedding Factory](https://github.com/choohongwook/ai-poc-test/blob/main/lib/langchain/embedding-factory.ts): `lib/langchain/embedding-factory.ts`
- [RAG Chain](https://github.com/choohongwook/ai-poc-test/blob/main/lib/langchain/rag-chain.ts): `lib/langchain/rag-chain.ts`
- [Schema Converter](https://github.com/choohongwook/ai-poc-test/blob/main/lib/langchain/schema-converter.ts): `lib/langchain/schema-converter.ts`

### Other components

- **User**

## Connections

- User → Generation Workspace: configures and submits (evidence: `app/page.tsx`)
- Generation Workspace → AI Configuration: renders (evidence: `app/page.tsx`)
- Generation Workspace → Schema Builder: renders (evidence: `app/page.tsx`)
- Generation Workspace → Prompt Editors: renders (evidence: `app/page.tsx`)
- Generation Workspace → Input and Files: renders (evidence: `app/page.tsx`)
- Generation Workspace → Output and History: renders (evidence: `app/page.tsx`)
- Generation Workspace → Generation Client: calls (evidence: `app/page.tsx`)
- Generation Workspace → History View: shares history with
- Generation Route → AI Provider Factory: imports (evidence: `app/api/generate/route.ts`)
- File Analysis UI → AI Configuration: renders (evidence: `app/upload-test/page.tsx`)
- File Analysis UI → Schema Builder: renders (evidence: `app/upload-test/page.tsx`)
- File Analysis UI → Prompt Editors: renders (evidence: `app/upload-test/page.tsx`)
- File Analysis UI → Upload Analysis Client: calls (evidence: `app/upload-test/page.tsx`)
- Regular Analysis Route → Document Loader: loads documents (evidence: `app/api/upload-analyze/route.ts`)
- Regular Analysis Route → Analysis Chain: runs analysis (evidence: `app/api/upload-analyze/route.ts`)
- Regular Analysis Route → AI Provider Factory: creates providers (evidence: `app/api/upload-analyze/route.ts`)
- Regular Analysis Route → Schema Converter: converts schema (evidence: `app/api/upload-analyze/route.ts`)
- Large File UI → Large Upload Client: calls (evidence: `app/upload-test-large/files-api/page.tsx`)
- Map Reduce Analysis → AI Provider Factory: creates providers (evidence: `app/api/upload-analyze-large/analyze/route.ts`)
- Map Reduce Analysis → Schema Converter: converts schema (evidence: `app/api/upload-analyze-large/analyze/route.ts`)
- RAG Workspace → RAG Panels: renders (evidence: `app/upload-test-large/rag/page.tsx`)
- RAG Workspace → RAG API Client: uses (evidence: `app/upload-test-large/rag/page.tsx`)
- Document Ingestion Route → Document Loader: loads documents (evidence: `app/api/upload-analyze-large/rag/ingest/route.ts`)
- Document Ingestion Route → Embedding Factory: creates embeddings (evidence: `app/api/upload-analyze-large/rag/ingest/route.ts`)
- Document Ingestion Route → Vector Store: ingests into (evidence: `app/api/upload-analyze-large/rag/ingest/route.ts`)
- RAG Query Route → Embedding Factory: creates embeddings (evidence: `app/api/upload-analyze-large/rag/query/route.ts`)
- RAG Query Route → Vector Store: searches (evidence: `app/api/upload-analyze-large/rag/query/route.ts`)
- RAG Query Route → RAG Chain: runs query chain (evidence: `app/api/upload-analyze-large/rag/query/route.ts`)
- RAG Query Route → AI Provider Factory: creates providers (evidence: `app/api/upload-analyze-large/rag/query/route.ts`)
- Document Listing Route → Vector Store: reads documents (evidence: `app/api/upload-analyze-large/rag/documents/route.ts`)
- Vector Store → Embedding Factory: creates embeddings (evidence: `lib/langchain/vector-store.ts`)
- Provider Settings → Provider Configuration: renders (evidence: `app/settings/page.tsx`)
- Key Validation Routes → Batch Key Adapters: uses adapters (evidence: `app/api/test-key/route.ts`)
