File size: 9,247 Bytes
6575706
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1c2d73c
6575706
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1c2d73c
6575706
 
 
 
 
 
 
 
 
1c2d73c
6575706
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1c2d73c
6575706
 
 
 
 
 
1c2d73c
6575706
 
 
 
1c2d73c
6575706
 
1c2d73c
6575706
 
 
 
 
1c2d73c
6575706
 
 
 
 
 
 
 
 
 
1c2d73c
6575706
1c2d73c
6575706
 
 
 
1c2d73c
6575706
 
 
 
 
 
 
1c2d73c
6575706
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1c2d73c
6575706
 
 
 
 
 
 
 
1c2d73c
 
 
 
 
 
 
6575706
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1c2d73c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
<!DOCTYPE html>
<html lang="ko">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>RAG 검색 챗봇</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
    <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='css/device-style.css') }}">
</head>
<body>
    <div class="container">
        <header>
            <h1>RAG 검색 챗봇</h1>
            <div class="header-actions">
                <div class="llm-selector">
                    <label for="llmSelect">LLM 선택:</label>
                    <select id="llmSelect">
                        </select>
                </div>
                <div class="user-info">
                    <span>μ‚¬μš©μž: {% if session.username %}{{ session.username }}{% else %}μ†λ‹˜{% endif %}</span>
                    <a href="{{ url_for('logout') }}" class="logout-button">
                        <i class="fas fa-sign-out-alt"></i> λ‘œκ·Έμ•„μ›ƒ
                    </a>
                </div>
            </div>
            <div class="tabs">
                <button id="chatTab" class="tab active">λŒ€ν™”</button>
                <button id="docsTab" class="tab">λ¬Έμ„œκ΄€λ¦¬</button>
                <button id="deviceTab" class="tab">μž₯μΉ˜μ œμ–΄</button>
            </div>
        </header>

        <main>
            <section id="chatSection" class="tab-content active">
                <div class="chat-container">
                    <div class="chat-messages" id="chatMessages">
                        <div class="message system">
                            <div class="message-content">
                                <p>μ•ˆλ…•ν•˜μ„Έμš”! μ§€μ‹λ² μ΄μŠ€μ— λŒ€ν•΄ κΆκΈˆν•œ 점을 λ¬Όμ–΄λ³΄μ„Έμš”. μŒμ„±μœΌλ‘œ μ§ˆλ¬Έν•˜μ‹œλ €λ©΄ 마이크 λ²„νŠΌμ„ λˆ„λ₯΄μ„Έμš”.</p>
                            </div>
                        </div>
                    </div>

                    <div class="chat-input-container">
                        <textarea id="userInput" placeholder="λ©”μ‹œμ§€λ₯Ό μž…λ ₯ν•˜μ„Έμš”..." rows="1"></textarea>
                        <button id="micButton" class="mic-button">
                            <i class="fas fa-microphone"></i>
                        </button>
                        <button id="sendButton" class="send-button">
                            <i class="fas fa-paper-plane"></i>
                        </button>
                    </div>

                    <div id="recordingStatus" class="recording-status hidden">
                        <div class="recording-indicator">
                            <div class="recording-pulse"></div>
                        </div>
                        <span>λ…ΉμŒ 쀑...</span>
                        <button id="stopRecordingButton" class="stop-recording-button">
                            <i class="fas fa-stop"></i>
                        </button>
                    </div>
                </div>
            </section>

            <section id="docsSection" class="tab-content">
                <div class="docs-container">
                    <div class="upload-section">
                        <h2>λ¬Έμ„œ μ—…λ‘œλ“œ</h2>
                        <p>μ§€μ‹λ² μ΄μŠ€μ— μΆ”κ°€ν•  λ¬Έμ„œλ₯Ό μ—…λ‘œλ“œν•˜μ„Έμš”. (지원 ν˜•μ‹: .txt, .md, .csv)</p>

                        <form id="uploadForm" enctype="multipart/form-data">
                            <div class="file-upload">
                                <input type="file" id="documentFile" name="document" accept=".txt,.md,.csv">
                                <label for="documentFile">파일 선택</label>
                                <span id="fileName">μ„ νƒλœ 파일 μ—†μŒ</span>
                            </div>

                            <button type="submit" id="uploadButton" class="upload-button">
                                <i class="fas fa-upload"></i> μ—…λ‘œλ“œ
                            </button>
                        </form>

                        <div id="uploadStatus" class="upload-status hidden"></div>
                    </div>

                    <div class="docs-list-section">
                        <h2>λ¬Έμ„œ λͺ©λ‘</h2>
                        <button id="refreshDocsButton" class="refresh-button">
                            <i class="fas fa-sync-alt"></i> μƒˆλ‘œκ³ μΉ¨
                        </button>

                        <div class="docs-list-container">
                            <table id="docsList" class="docs-list">
                                <thead>
                                    <tr>
                                        <th>파일λͺ…</th>
                                        <th>청크 수</th>
                                        <th>μœ ν˜•</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    </tbody>
                            </table>

                            <div id="docsLoading" class="loading-indicator">
                                <div class="spinner"></div>
                                <p>λ¬Έμ„œ λ‘œλ”© 쀑...</p>
                            </div>

                            <div id="noDocsMessage" class="no-docs-message hidden">
                                <p>μ§€μ‹λ² μ΄μŠ€μ— λ“±λ‘λœ λ¬Έμ„œκ°€ μ—†μŠ΅λ‹ˆλ‹€. λ¬Έμ„œλ₯Ό μ—…λ‘œλ“œν•΄ μ£Όμ„Έμš”.</p>
                            </div>
                        </div>
                    </div>
                </div>
            </section>

            <section id="deviceSection" class="tab-content">
                <div class="device-connection">
                    <h3>1. μž₯치 μ„œλ²„ μ—°κ²°</h3>
                    <div class="device-connection-form">
                        <input type="text" id="deviceServerUrlInput" placeholder="LocalPCAgent Ngrok URL μž…λ ₯ (https://xxxx-xx-xxx-xxx.ngrok-free.app ν˜•μ‹)">
                        <button id="connectDeviceServerBtn">μ—°κ²°</button>
                    </div>
                    <div id="deviceConnectionStatus" class="connection-status disconnected">μ—°κ²° μƒνƒœ: μ—°κ²°λ˜μ§€ μ•ŠμŒ</div>
                </div>

                <div id="deviceBasicFunctions" class="device-functions">
                    <h3>2. κΈ°λ³Έ κΈ°λŠ₯</h3>
                    <div class="function-buttons">
                        <button id="checkDeviceStatusBtn">μž₯치 μƒνƒœ 확인</button>
                    </div>
                    <textarea id="deviceStatusResult" class="device-status-result" readonly></textarea>
                </div>

                <div id="deviceProgramControl" class="program-control">
                    <h3>3. ν”„λ‘œκ·Έλž¨ μ‹€ν–‰</h3>
                    <div class="function-buttons">
                        <button id="getProgramsBtn">ν”„λ‘œκ·Έλž¨ λͺ©λ‘ μƒˆλ‘œκ³ μΉ¨</button>
                    </div>
                    <div id="programsList" class="program-list-container">
                        <div class="no-programs-message">ν”„λ‘œκ·Έλž¨ λͺ©λ‘μ΄ 여기에 ν‘œμ‹œλ©λ‹ˆλ‹€.</div>
                    </div>
                    <div class="program-select-container">
                        <select id="programSelectDropdown">
                            <option value="">-- λͺ©λ‘ μƒˆλ‘œκ³ μΉ¨ ν›„ 선택 --</option>
                        </select>
                    </div>
                    <button id="executeProgramBtn" class="execute-btn" disabled>μ„ νƒν•œ ν”„λ‘œκ·Έλž¨ μ‹€ν–‰</button>
                    <div id="executeResult" class="execute-result"></div>
                </div>

                <div id="deviceCustomControl" class="program-control">
                    <h3>4. μ‚¬μš©μž μ •μ˜ ν”„λ‘œκ·Έλž¨ μ‹€ν–‰</h3>
                    <div class="custom-command-container">
                        <input type="text" id="customCommandInput" placeholder="μ‹€ν–‰ν•  λͺ…λ Ήμ–΄ λ˜λŠ” ν”„λ‘œκ·Έλž¨ 경둜 μž…λ ₯">
                        <button id="executeCustomBtn">μ‹€ν–‰</button>
                    </div>
                    <div id="customExecuteResult" class="execute-result"></div>
                </div>

                <div id="devicePortScanControl" class="program-control"> <h3>5. μž₯치 포트 쑰회</h3>
                    <div class="function-buttons">
                        <button id="scanPortsBtn">μž₯치 포트 μŠ€μΊ”</button>
                    </div>
                    <div id="portsStatus" class="ports-status"></div> <div id="portsResults" class="ports-results"></div> </div>
                </section>
        </main>

        <footer>
            <p>Β© 2025 RAG 검색 챗봇 | OpenAI/DeepSeek LLM & VITO STT ν™œμš©</p>
            <div class="current-llm">
                <span>Current LLM: </span>
                <span id="currentLLMInfo">-</span>
            </div>
        </footer>
    </div>

    <script src="{{ url_for('static', filename='js/app-core.js') }}"></script>
    <script src="{{ url_for('static', filename='js/app-device.js') }}"></script>
    <script src="{{ url_for('static', filename='js/app.js') }}"></script>
</body>
</html>