Skip to content

πŸ† 2025 Advantech AIoT Innoworks μš°μˆ˜μƒ | AIoT μ§€λŠ₯ν˜• μ—λ„ˆμ§€ 관리 챗봇

Notifications You must be signed in to change notification settings

ThinkMuk/factory-chatbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

63 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Energy Management System - Client

AIoT 기반 μ§€λŠ₯ν˜• μ—λ„ˆμ§€ 관리 μ‹œμŠ€ν…œμ˜ ν΄λΌμ΄μ–ΈνŠΈμž…λ‹ˆλ‹€.

LLMκ³Ό MCP(Model Context Protocol)λ₯Ό κ²°ν•©ν•˜μ—¬ μžμ—°μ–΄ 기반 μ—λ„ˆμ§€ 관리 μΈν„°νŽ˜μ΄μŠ€λ₯Ό κ΅¬ν˜„ν–ˆμŠ΅λ‹ˆλ‹€. μ‚¬μš©μžλŠ” λŒ€ν™”λ₯Ό 톡해 μ „λ ₯ 데이터 쑰회, TimesFM 기반 μ‹œκ³„μ—΄ 예츑, IoT κΈ°κΈ° μ œμ–΄λ₯Ό μˆ˜ν–‰ν•  수 μžˆμŠ΅λ‹ˆλ‹€. SSE(Server-Sent Events) 슀트리밍으둜 μ‹€μ‹œκ°„ 응닡을 μ œκ³΅ν•˜λ©°, λΆ„μœ„μˆ˜ 기반 예츑으둜 λΆˆν™•μ‹€μ„± κ΅¬κ°„κΉŒμ§€ μ‹œκ°ν™”ν•˜μ—¬ 데이터 기반 μ˜μ‚¬κ²°μ •μ„ μ§€μ›ν•©λ‹ˆλ‹€.

μˆ˜μƒ

πŸ† 2025 Advantech AIoT Innoworks Project μš°μˆ˜μƒ (3λ“±)

μ‹œμŠ€ν…œ μ•„ν‚€ν…μ²˜

α„‘α…³α„…α…©α„Œα…¦α†¨α„α…³ α„‹α…‘α„α…΅α„α…¦α†¨α„Žα…§

기술 μŠ€νƒ

  • Framework: Next.js 15 (App Router)
  • Language: TypeScript 5.9
  • Styling: Tailwind CSS 4
  • API Communication: SSE (Server-Sent Events)

μ‹œμž‘ν•˜κΈ°

μš”κ΅¬μ‚¬ν•­

  • Node.js >= 18.18.0

μ„€μΉ˜ 및 μ‹€ν–‰

npm install
npm run dev      # 개발 μ„œλ²„ (http://localhost:3000)
npm run build    # ν”„λ‘œλ•μ…˜ λΉŒλ“œ
npm run lint     # ESLint 검사

ν™˜κ²½ λ³€μˆ˜

# .env.local
NEXT_PUBLIC_API_URL=<λ°±μ—”λ“œ API μ£Όμ†Œ>

ν”„λ‘œμ νŠΈ ꡬ쑰

app/
β”œβ”€β”€ _api/           # API 톡신 λ ˆμ΄μ–΄ (μž¬μ‹œλ„, νƒ€μž„μ•„μ›ƒ, μ—λŸ¬ 처리)
β”œβ”€β”€ _lib/           # λΉ„μ¦ˆλ‹ˆμŠ€ 둜직
β”œβ”€β”€ _hooks/         # μ»€μŠ€ν…€ React Hooks
β”œβ”€β”€ _components/    # UI μ»΄ν¬λ„ŒνŠΈ
β”œβ”€β”€ chat/[id]/      # 동적 μ±„νŒ…λ°© νŽ˜μ΄μ§€
└── types.ts        # TypeScript νƒ€μž… μ •μ˜

μ£Όμš” 섀계 κ²°μ •

SSE 슀트리밍

μ‹€μ‹œκ°„ 응닡을 μœ„ν•œ Server-Sent Events κ΅¬ν˜„:

const response = await createChatRoom(question, {
  onAnswerChunk: ({ chunk, accumulated }) => {
    setStreamingAnswer(accumulated);
  },
});

API λ ˆμ΄μ–΄ 뢄리

관심사 뢄리 원칙에 따라 _api/ λ””λ ‰ν† λ¦¬μ—μ„œ 톡신 λ‘œμ§μ„ 뢄리:

  • μ§€μˆ˜ λ°±μ˜€ν”„ 기반 μžλ™ μž¬μ‹œλ„
  • AbortControllerλ₯Ό ν™œμš©ν•œ νƒ€μž„μ•„μ›ƒ 처리
  • μ»€μŠ€ν…€ μ—λŸ¬ 클래슀(ChatApiError)λ₯Ό ν†΅ν•œ μ—λŸ¬ μ •κ·œν™”

μ»€μŠ€ν…€ ν›… νŒ¨ν„΄

UI 둜직과 λΉ„μ¦ˆλ‹ˆμŠ€ λ‘œμ§μ„ λΆ„λ¦¬ν•˜μ—¬ μž¬μ‚¬μš©μ„±κ³Ό ν…ŒμŠ€νŠΈ μš©μ΄μ„± 확보:

  • useChatMessaging: λ©”μ‹œμ§€ 전솑/μˆ˜μ‹  및 슀트리밍 μƒνƒœ 관리
  • useChatRoomList: μ±„νŒ…λ°© λͺ©λ‘ 쑰회 및 λ¬΄ν•œ 슀크둀
  • useAutoScroll: 슀트리밍 응닡 μ‹œ μžλ™ 슀크둀 (μ‚¬μš©μž 슀크둀 μ‹œ λΉ„ν™œμ„±ν™”)

νƒ€μž… μ•ˆμ „μ„±

BigInt ID의 정밀도 손싀 λ°©μ§€λ₯Ό μœ„ν•œ λ¬Έμžμ—΄ μ •κ·œν™”:

function normalizeIdValue(value: unknown): string {
  if (typeof value === 'bigint') return value.toString();
  if (typeof value === 'string') {
    try { return BigInt(value).toString(); } 
    catch { return value; }
  }
  return String(value);
}

개발 도ꡬ

  • ESLint: next/core-web-vitals, next/typescript κ·œμΉ™ 적용
  • TypeScript: strict λͺ¨λ“œ

About

πŸ† 2025 Advantech AIoT Innoworks μš°μˆ˜μƒ | AIoT μ§€λŠ₯ν˜• μ—λ„ˆμ§€ 관리 챗봇

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages