John2121 commited on
Commit
cd2200a
Β·
verified Β·
1 Parent(s): a88770d

please integrate context and make sure that we are actually chatting with the llama models via llama api client - Initial Deployment

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +302 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Exit Agent
3
- emoji: πŸ“š
4
- colorFrom: purple
5
- colorTo: red
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: exit-agent
3
+ emoji: 🐳
4
+ colorFrom: yellow
5
+ colorTo: blue
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,302 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>EXITAGENT - EXIT CW Realty</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
11
+
12
+ body {
13
+ font-family: 'Inter', sans-serif;
14
+ background: linear-gradient(135deg, #0c4a6e 0%, #0d9488 100%);
15
+ min-height: 100vh;
16
+ }
17
+
18
+ .chat-container {
19
+ max-width: 1200px;
20
+ height: 90vh;
21
+ box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25);
22
+ border-radius: 16px;
23
+ overflow: hidden;
24
+ border: 1px solid rgba(255, 255, 255, 0.1);
25
+ }
26
+
27
+ .message-edward {
28
+ background: linear-gradient(135deg, #0d9488 0%, #0c4a6e 100%);
29
+ color: white;
30
+ border-radius: 18px 18px 4px 18px;
31
+ max-width: 80%;
32
+ animation: fadeIn 0.3s ease-in-out;
33
+ border: 1px solid rgba(255, 255, 255, 0.1);
34
+ }
35
+
36
+ .message-user {
37
+ background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
38
+ color: white;
39
+ border-radius: 18px 18px 18px 4px;
40
+ max-width: 80%;
41
+ animation: fadeIn 0.3s ease-in-out;
42
+ border: 1px solid rgba(255, 255, 255, 0.1);
43
+ }
44
+
45
+ .type-indicator {
46
+ display: flex;
47
+ padding: 10px;
48
+ }
49
+
50
+ .type-dot {
51
+ width: 8px;
52
+ height: 8px;
53
+ background-color: #0d9488;
54
+ border-radius: 50%;
55
+ margin: 0 3px;
56
+ animation: pulse 1.5s infinite;
57
+ }
58
+
59
+ .type-dot:nth-child(2) {
60
+ animation-delay: 0.3s;
61
+ }
62
+
63
+ .type-dot:nth-child(3) {
64
+ animation-delay: 0.6s;
65
+ }
66
+
67
+ @keyframes pulse {
68
+ 0%, 100% { opacity: 0.4; transform: scale(0.8); }
69
+ 50% { opacity: 1; transform: scale(1.2); }
70
+ }
71
+
72
+ @keyframes fadeIn {
73
+ from { opacity: 0; transform: translateY(10px); }
74
+ to { opacity: 1; transform: translateY(0); }
75
+ }
76
+
77
+ .suggestion-chip {
78
+ transition: all 0.2s ease;
79
+ cursor: pointer;
80
+ background: linear-gradient(135deg, #0d9488 0%, #0c4a6e 100%);
81
+ }
82
+
83
+ .suggestion-chip:hover {
84
+ transform: translateY(-2px);
85
+ box-shadow: 0 4px 12px rgba(13, 148, 136, 0.4);
86
+ }
87
+
88
+ .typing-area:focus {
89
+ outline: none;
90
+ box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.5);
91
+ }
92
+
93
+ .exit-agent-header {
94
+ font-weight: 800;
95
+ letter-spacing: 0.15em;
96
+ text-transform: uppercase;
97
+ background: linear-gradient(135deg, #ffffff 0%, #cffafe 100%);
98
+ -webkit-background-clip: text;
99
+ -webkit-text-fill-color: transparent;
100
+ background-clip: text;
101
+ filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
102
+ }
103
+ </style>
104
+ </head>
105
+ <body class="flex items-center justify-center p-4 md:p-8">
106
+ <div class="chat-container w-full flex flex-col bg-slate-800">
107
+ <!-- Header -->
108
+ <div class="bg-slate-900 px-6 py-4 flex items-center justify-between border-b border-slate-700/50">
109
+ <div class="flex items-center">
110
+ <div class="w-12 h-12 rounded-full bg-gradient-to-r from-cyan-500 to-teal-600 flex items-center justify-center text-white font-bold text-xl">
111
+ E
112
+ </div>
113
+ <div class="ml-4">
114
+ <h1 class="exit-agent-header text-2xl">EXITAGENT</h1>
115
+ <p class="text-slate-300 text-xs tracking-wide">STEVENS POINT REAL ESTATE INTELLIGENCE</p>
116
+ </div>
117
+ </div>
118
+ <div class="hidden md:block">
119
+ <span class="bg-emerald-500/20 text-emerald-400 text-xs px-3 py-1 rounded-full font-medium tracking-wide">LIVE CONNECTED</span>
120
+ </div>
121
+ </div>
122
+
123
+ <!-- Chat Messages -->
124
+ <div class="flex-1 p-4 md:p-6 overflow-y-auto space-y-4" id="chat-messages">
125
+ <!-- Initial message from Edward -->
126
+ <div class="flex justify-end">
127
+ <div class="message-edward p-4 md:p-5">
128
+ <p class="text-sm md:text-base">Hey Brandon, Edward here β€” just your friendly neighborhood Central WI real estate strategist. Let's cut to the chase: want me to show you leads you didn't even know you had, or are we just checking in today? πŸ˜‰</p>
129
+ </div>
130
+ </div>
131
+ </div>
132
+
133
+ <!-- Suggestions -->
134
+ <div class="px-4 md:px-6 py-3 bg-slate-700/30 hidden md:block" id="suggestions">
135
+ <div class="flex flex-wrap gap-2">
136
+ <div class="suggestion-chip text-white text-xs md:text-sm px-3 py-2 rounded-full" onclick="sendMessage('Show me Stevens Point market trends')">Stevens Point market trends</div>
137
+ <div class="suggestion-chip text-white text-xs md:text-sm px-3 py-2 rounded-full" onclick="sendMessage('New lead generation ideas')">New lead generation ideas</div>
138
+ <div class="suggestion-chip text-white text-xs md:text-sm px-3 py-2 rounded-full" onclick="sendMessage('Competitor analysis for Portage County')">Competitor analysis</div>
139
+ <div class="suggestion-chip text-white text-xs md:text-sm px-3 py-2 rounded-full" onclick="sendMessage('Help me with a client objection')">Handle client objections</div>
140
+ </div>
141
+ </div>
142
+
143
+ <!-- Typing indicator (hidden by default) -->
144
+ <div class="px-6 py-2 hidden" id="typing-indicator">
145
+ <div class="type-indicator">
146
+ <div class="type-dot"></div>
147
+ <div class="type-dot"></div>
148
+ <div class="type-dot"></div>
149
+ </div>
150
+ </div>
151
+
152
+ <!-- Input Area -->
153
+ <div class="p-4 md:p-6 bg-slate-900/80">
154
+ <div class="flex items-center">
155
+ <input
156
+ type="text"
157
+ id="user-input"
158
+ placeholder="Type your message here..."
159
+ class="typing-area flex-1 bg-slate-800/70 text-white rounded-l-lg px-4 py-3 focus:outline-none border border-slate-600/50"
160
+ onkeypress="if(event.key === 'Enter') sendMessage()"
161
+ >
162
+ <button
163
+ onclick="sendMessage()"
164
+ class="bg-gradient-to-r from-cyan-600 to-teal-600 hover:from-cyan-700 hover:to-teal-700 text-white px-4 md:px-6 py-3 rounded-r-lg transition-all duration-200 transform hover:scale-105"
165
+ >
166
+ <i class="fas fa-paper-plane"></i>
167
+ </button>
168
+ </div>
169
+ </div>
170
+ </div>
171
+
172
+ <script>
173
+ const chatMessages = document.getElementById('chat-messages');
174
+ const userInput = document.getElementById('user-input');
175
+ const typingIndicator = document.getElementById('typing-indicator');
176
+ const suggestions = document.getElementById('suggestions');
177
+
178
+ // Store conversation history
179
+ let conversationHistory = [
180
+ {
181
+ role: "system",
182
+ content: "You are Edward, a friendly neighborhood Central WI real estate strategist from EXIT CW Realty. You're knowledgeable about Stevens Point real estate market, lead generation, competitor analysis, and handling client objections. You're direct, professional but approachable, and focused on helping real estate agents succeed. Keep responses concise and actionable."
183
+ },
184
+ {
185
+ role: "assistant",
186
+ content: "Hey Brandon, Edward here β€” just your friendly neighborhood Central WI real estate strategist. Let's cut to the chase: want me to show you leads you didn't even know you had, or are we just checking in today? πŸ˜‰"
187
+ }
188
+ ];
189
+
190
+ // LLaMA API configuration
191
+ const LLAMA_API_URL = 'https://api.llama-api.com/chat/completions';
192
+ const LLAMA_API_KEY = 'your-llama-api-key-here'; // Replace with your actual API key
193
+
194
+ // Add message to chat
195
+ function addMessage(message, isUser = false) {
196
+ const messageDiv = document.createElement('div');
197
+ messageDiv.className = `flex ${isUser ? 'justify-start' : 'justify-end'}`;
198
+
199
+ const messageContent = document.createElement('div');
200
+ messageContent.className = isUser ? 'message-user p-4 md:p-5' : 'message-edward p-4 md:p-5';
201
+ messageContent.innerHTML = `<p class="text-sm md:text-base">${message}</p>`;
202
+
203
+ messageDiv.appendChild(messageContent);
204
+ chatMessages.appendChild(messageDiv);
205
+
206
+ // Scroll to bottom
207
+ chatMessages.scrollTop = chatMessages.scrollHeight;
208
+ }
209
+
210
+ // Show typing indicator
211
+ function showTypingIndicator() {
212
+ typingIndicator.classList.remove('hidden');
213
+ chatMessages.scrollTop = chatMessages.scrollHeight;
214
+ }
215
+
216
+ // Hide typing indicator
217
+ function hideTypingIndicator() {
218
+ typingIndicator.classList.add('hidden');
219
+ }
220
+
221
+ // Get response from LLaMA API
222
+ async function getLlamaResponse(userMessage) {
223
+ try {
224
+ // Add user message to conversation history
225
+ conversationHistory.push({
226
+ role: "user",
227
+ content: userMessage
228
+ });
229
+
230
+ const response = await fetch(LLAMA_API_URL, {
231
+ method: 'POST',
232
+ headers: {
233
+ 'Content-Type': 'application/json',
234
+ 'Authorization': `Bearer ${LLAMA_API_KEY}`
235
+ },
236
+ body: JSON.stringify({
237
+ model: "llama-3-70b",
238
+ messages: conversationHistory,
239
+ temperature: 0.7,
240
+ max_tokens: 500
241
+ })
242
+ });
243
+
244
+ if (!response.ok) {
245
+ throw new Error(`API error: ${response.status}`);
246
+ }
247
+
248
+ const data = await response.json();
249
+ const assistantResponse = data.choices[0].message.content;
250
+
251
+ // Add assistant response to conversation history
252
+ conversationHistory.push({
253
+ role: "assistant",
254
+ content: assistantResponse
255
+ });
256
+
257
+ return assistantResponse;
258
+
259
+ } catch (error) {
260
+ console.error('Error calling LLaMA API:', error);
261
+ return "I'm having trouble connecting to my systems right now. Let's try again in a moment, or you can ask me about Stevens Point market trends, lead generation, or client strategies!";
262
+ }
263
+ }
264
+
265
+ // Send message function
266
+ async function sendMessage(predefinedMessage = null) {
267
+ const message = predefinedMessage || userInput.value.trim();
268
+
269
+ if (message === '') return;
270
+
271
+ // Add user message
272
+ addMessage(message, true);
273
+
274
+ // Clear input field if not using predefined message
275
+ if (!predefinedMessage) {
276
+ userInput.value = '';
277
+ }
278
+
279
+ // Hide suggestions after first message
280
+ suggestions.classList.add('hidden');
281
+
282
+ // Show Edward is typing
283
+ showTypingIndicator();
284
+
285
+ try {
286
+ // Get response from LLaMA API
287
+ const response = await getLlamaResponse(message);
288
+ hideTypingIndicator();
289
+ addMessage(response, false);
290
+ } catch (error) {
291
+ hideTypingIndicator();
292
+ addMessage("Sorry, I'm experiencing technical difficulties. Please try again shortly.", false);
293
+ }
294
+ }
295
+
296
+ // Initialize with suggestions visible
297
+ window.onload = function() {
298
+ chatMessages.scrollTop = chatMessages.scrollHeight;
299
+ }
300
+ </script>
301
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=John2121/exit-agent" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
302
+ </html>