LuckyEnforceAgent commited on
Commit
5beea39
·
verified ·
1 Parent(s): e8a6ed7

I WANT TO USE ANYTHING LLM AS THE AI THAT CAN BE TRAINED

Browse files
Files changed (2) hide show
  1. chat.html +8 -22
  2. index.html +3 -3
chat.html CHANGED
@@ -143,10 +143,9 @@ waypoint.SetType(EWaypointType.MOVE);</pre>
143
  <script>
144
  // Initialize feather icons
145
  feather.replace();
146
-
147
- // Connect to LM Studio API
148
- const API_URL = 'http://localhost:1234/v1/chat/completions';
149
- const chatContainer = document.querySelector('.chat-container');
150
  const chatForm = document.getElementById('chatForm');
151
  const userInput = document.getElementById('userInput');
152
  const typingIndicator = document.getElementById('typingIndicator');
@@ -178,28 +177,15 @@ waypoint.SetType(EWaypointType.MOVE);</pre>
178
  'Content-Type': 'application/json'
179
  },
180
  body: JSON.stringify({
181
- model: 'local-model', // Should match your LM Studio model
182
- messages: [
183
- {
184
- role: 'system',
185
- content: 'You are ArmaForge Assistant, an expert in Arma Reforger modding and scripting. Provide detailed, technical answers with code examples when possible. Format code blocks properly.'
186
- },
187
- {
188
- role: 'user',
189
- content: prompt
190
- }
191
- ],
192
- temperature: 0.7,
193
- max_tokens: 2000,
194
- stream: false
195
  })
196
- });
197
 
198
  if (!response.ok) throw new Error('Network response was not ok');
199
-
200
  const data = await response.json();
201
- return data.choices[0].message.content;
202
- } catch (error) {
203
  console.error('Error:', error);
204
  return "Sorry, I encountered an error. Please ensure LM Studio is running and the API is accessible at http://localhost:1234";
205
  } finally {
 
143
  <script>
144
  // Initialize feather icons
145
  feather.replace();
146
+ // Connect to AnythingLLM API
147
+ const API_URL = 'http://localhost:3001/api/v1/workspace/default/chat'; // Default AnythingLLM endpoint
148
+ const chatContainer = document.querySelector('.chat-container');
 
149
  const chatForm = document.getElementById('chatForm');
150
  const userInput = document.getElementById('userInput');
151
  const typingIndicator = document.getElementById('typingIndicator');
 
177
  'Content-Type': 'application/json'
178
  },
179
  body: JSON.stringify({
180
+ message: prompt,
181
+ mode: "query" // Can be "query" or "chat"
 
 
 
 
 
 
 
 
 
 
 
 
182
  })
183
+ });
184
 
185
  if (!response.ok) throw new Error('Network response was not ok');
 
186
  const data = await response.json();
187
+ return data.textResponse;
188
+ } catch (error) {
189
  console.error('Error:', error);
190
  return "Sorry, I encountered an error. Please ensure LM Studio is running and the API is accessible at http://localhost:1234";
191
  } finally {
index.html CHANGED
@@ -56,11 +56,11 @@
56
  <section class="mb-16 text-center">
57
  <h2 class="text-4xl md:text-5xl font-bold mb-6 glow-text">Your <span class="text-teal-400">Arma Reforger</span> Modding Expert</h2>
58
  <p class="text-xl md:text-2xl text-gray-300 max-w-3xl mx-auto mb-8">
59
- Get instant help with script debugging, mod creation, and troubleshooting for Arma Reforger.
60
  </p>
61
- <div class="flex justify-center space-x-4">
62
  <a href="chat.html" class="bg-teal-600 hover:bg-teal-500 text-white px-6 py-3 rounded-lg font-medium flex items-center transition">
63
- <i data-feather="terminal" class="mr-2"></i> Start Modding Chat
64
  </a>
65
  <button class="border border-teal-400 text-teal-400 hover:bg-teal-900/50 px-6 py-3 rounded-lg font-medium flex items-center transition">
66
  <i data-feather="download" class="mr-2"></i> Get Templates
 
56
  <section class="mb-16 text-center">
57
  <h2 class="text-4xl md:text-5xl font-bold mb-6 glow-text">Your <span class="text-teal-400">Arma Reforger</span> Modding Expert</h2>
58
  <p class="text-xl md:text-2xl text-gray-300 max-w-3xl mx-auto mb-8">
59
+ Powered by AnythingLLM - Your customizable AI assistant trained on Arma Reforger documentation.
60
  </p>
61
+ <div class="flex justify-center space-x-4">
62
  <a href="chat.html" class="bg-teal-600 hover:bg-teal-500 text-white px-6 py-3 rounded-lg font-medium flex items-center transition">
63
+ <i data-feather="terminal" class="mr-2"></i> Chat with AnythingLLM
64
  </a>
65
  <button class="border border-teal-400 text-teal-400 hover:bg-teal-900/50 px-6 py-3 rounded-lg font-medium flex items-center transition">
66
  <i data-feather="download" class="mr-2"></i> Get Templates