forked from techcow2/lmsa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
176 lines (168 loc) · 10.5 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LMSA</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="styles.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<!-- CodeMirror CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.2/codemirror.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.2/theme/monokai.min.css">
<!-- CodeMirror JS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.2/codemirror.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.2/mode/javascript/javascript.min.js"></script>
<script>
tailwind.config = {
darkMode: 'class',
theme: {
extend: {
colors: {
darkBg: '#121212',
darkSecondary: '#1e1e1e',
darkTertiary: '#2c2c2c',
},
},
},
}
</script>
</head>
<body class="bg-darkBg text-gray-100 dark custom-dark-mode">
<div class="flex flex-col h-screen">
<!-- Header -->
<header class="bg-darkSecondary p-4 flex justify-between items-center animate-fade-in">
<div class="flex items-center">
<img src="icon22.png" alt="LMSA Icon" class="w-8 h-8 mr-2">
<h1 class="text-2xl font-bold">LMSA</h1>
</div>
<button id="sidebar-toggle" class="md:hidden text-gray-100 p-2 rounded-md hover:bg-darkTertiary focus:outline-none" aria-label="Toggle Sidebar">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"></path>
</svg>
</button>
</header>
<!-- Model display bar -->
<div id="loaded-model" class="bg-darkTertiary text-blue-400 font-bold py-2 px-4 text-center animate-fade-in"></div>
<div class="flex flex-1 overflow-hidden">
<!-- Sidebar -->
<div id="sidebar" class="w-full md:w-64 bg-darkSecondary p-4 hidden md:flex md:flex-col animate-slide-in">
<div class="flex justify-between items-center mb-4 md:hidden">
<h2 class="text-xl font-bold">Menu</h2>
<button id="close-sidebar" class="text-gray-100 p-2 rounded-md hover:bg-darkTertiary focus:outline-none" aria-label="Close Sidebar">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
</svg>
</button>
</div>
<div id="sidebar-buttons" class="flex flex-col h-full">
<div>
<button id="new-chat" class="w-full bg-blue-600 text-gray-100 rounded-lg px-4 py-2 mb-4 hover:bg-blue-700 focus:outline-none transition-all duration-300 ease-in-out">
<i class="fas fa-plus-circle mr-2"></i>New Chat
</button>
<button id="settings-btn" class="w-full bg-darkTertiary text-gray-100 rounded-lg px-4 py-2 mb-4 hover:bg-gray-600 focus:outline-none transition-all duration-300 ease-in-out">
<i class="fas fa-cog mr-2"></i>Settings
</button>
</div>
<div id="chat-history" class="flex-grow overflow-y-auto"></div>
</div>
</div>
<!-- Main content -->
<div class="flex-1 flex flex-col overflow-hidden bg-darkBg">
<!-- Chat container -->
<div id="chat-container" class="flex-1 overflow-y-auto p-4 flex flex-col">
<div id="welcome-message" class="flex-1 flex items-center justify-center text-center text-gray-400 animate-fade-in">
<div>
<i class="fas fa-comment-dots text-5xl mb-4"></i>
<p>
<strong>Welcome to LM Studio Assistant!</strong><br><br>
Start a new chat or select an existing one from the side menu.
</p>
</div>
</div>
<div id="messages"></div>
<div id="loading-indicator" class="hidden">
<span class="loading-ellipsis">...</span>
</div>
</div>
<!-- Input area -->
<div class="border-t border-darkTertiary animate-fade-in">
<form id="chat-form" class="flex p-4">
<div class="flex-grow relative">
<input type="text" id="user-input" class="w-full bg-darkTertiary text-gray-100 border border-gray-600 rounded-l-lg px-4 py-2 focus:outline-none" placeholder="Type your message..." aria-label="Type your message" autocomplete="off">
</div>
<button type="submit" id="send-button" class="bg-blue-600 text-white rounded-r-lg px-6 py-2 hover:bg-blue-700 focus:outline-none transition-all duration-300 ease-in-out">
<i class="fas fa-paper-plane mr-2"></i>Send
</button>
<button type="button" id="stop-button" class="bg-red-600 text-white rounded-r-lg px-6 py-2 hover:bg-red-700 focus:outline-none transition-all duration-300 ease-in-out hidden">
<i class="fas fa-stop mr-2"></i>Stop
</button>
</form>
</div>
</div>
</div>
</div>
<!-- Settings modal -->
<div id="settings-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center hidden animate-fade-in" aria-labelledby="settings-title" role="dialog" aria-modal="true">
<div class="bg-darkSecondary p-6 rounded-lg w-96 max-w-[90%] shadow-lg">
<h2 id="settings-title" class="text-xl font-bold mb-4 flex items-center">
<i class="fas fa-cog mr-2 text-blue-500"></i>Settings
</h2>
<div class="mb-4">
<label for="server-url" class="block text-sm font-medium mb-1">LM Studio Server URL:</label>
<div class="relative">
<input type="text" id="server-url" class="w-full bg-darkTertiary text-gray-100 border border-gray-600 rounded px-3 py-2 focus:outline-none" value="http://localhost:1234" placeholder="Enter server URL">
</div>
</div>
<div class="mb-4">
<label for="system-prompt" class="block text-sm font-medium mb-1">System Prompt:</label>
<div class="relative">
<textarea id="system-prompt" class="w-full bg-darkTertiary text-gray-100 border border-gray-600 rounded px-3 py-2 focus:outline-none" rows="4" placeholder="Enter system prompt"></textarea>
</div>
</div>
<div class="mb-4">
<label for="temperature" class="block text-sm font-medium mb-1">Temperature: <span id="temperature-value">0.9</span></label>
<div class="flex items-center">
<input type="range" id="temperature" min="0" max="2" step="0.1" value="0.9" class="w-full bg-darkTertiary text-gray-100 rounded-lg appearance-none cursor-pointer" disabled>
<button id="temperature-lock" class="ml-2 text-gray-100 focus:outline-none" aria-label="Toggle Temperature Lock">
<i class="fas fa-lock"></i>
</button>
</div>
</div>
<button id="clear-chat" class="w-full bg-darkTertiary text-gray-100 rounded-lg px-4 py-2 hover:bg-gray-600 focus:outline-none mb-2 transition-all duration-300 ease-in-out">
<i class="fas fa-trash-alt mr-2"></i>Clear Chat
</button>
<button id="close-settings" class="w-full bg-blue-600 text-white rounded-lg px-4 py-2 hover:bg-blue-700 focus:outline-none transition-all duration-300 ease-in-out">
<i class="fas fa-check mr-2"></i>Close
</button>
</div>
</div>
<!-- Confirmation modal -->
<div id="confirmation-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center hidden animate-fade-in" aria-labelledby="confirmation-title" role="dialog" aria-modal="true">
<div class="bg-darkSecondary p-6 rounded-lg w-96 max-w-[90%] shadow-lg">
<h2 id="confirmation-title" class="text-xl font-bold mb-4 flex items-center">
<i class="fas fa-exclamation-triangle mr-2 text-yellow-500"></i>Confirm Action
</h2>
<p id="confirmation-message" class="mb-4"></p>
<div class="flex justify-end space-x-4">
<button id="cancel-action" class="bg-darkTertiary text-gray-100 rounded-lg px-4 py-2 hover:bg-gray-600 focus:outline-none transition-all duration-300 ease-in-out">
Cancel
</button>
<button id="confirm-action" class="bg-red-600 text-white rounded-lg px-4 py-2 hover:bg-red-700 focus:outline-none transition-all duration-300 ease-in-out">
Confirm
</button>
</div>
</div>
</div>
<!-- Context menu for LLM-generated text -->
<div id="context-menu" class="hidden fixed bg-darkSecondary border border-gray-600 rounded-lg shadow-lg z-50">
<button id="copy-text" class="w-full text-left px-4 py-2 hover:bg-darkTertiary focus:outline-none">
<i class="fas fa-copy mr-2"></i>Copy
</button>
<button id="regenerate-text" class="w-full text-left px-4 py-2 hover:bg-darkTertiary focus:outline-none">
<i class="fas fa-redo mr-2"></i>Regenerate
</button>
</div>
<script src="app.js"></script>
</body>
</html>