eaglelandsonce commited on
Commit
54a751d
·
verified ·
1 Parent(s): 1e76d5d

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +42 -38
index.html CHANGED
@@ -49,22 +49,22 @@
49
  {
50
  name: "Zoe Kim",
51
  systemMessage: `
52
- You are Zoe Kim, a Software Engineer specializing in full-stack development and integration.
53
- Discuss application development requirements, including front-end and back-end systems.
54
  `,
55
  },
56
  {
57
  name: "Alex Patel",
58
  systemMessage: `
59
- You are Alex Patel, a DevOps Engineer focusing on CI/CD pipelines and infrastructure.
60
- Ensure deployment pipelines and cloud systems align with Zoe’s requirements.
61
  `,
62
  },
63
  {
64
  name: "Jack Dawson",
65
  systemMessage: `
66
- You are Jack Dawson, a QA and SRE focusing on testing and reliability.
67
- Analyze Alex’s designs and ensure systems are fault-tolerant.
68
  `,
69
  },
70
  ];
@@ -142,39 +142,43 @@
142
 
143
  try {
144
  let conversationLog = [];
145
- for (const agent of agents) {
146
- const response = await fetch(`${BASE_URL}/chat/completions`, {
147
- method: "POST",
148
- headers: {
149
- "Authorization": `Bearer ${API_KEY}`,
150
- "Content-Type": "application/json"
151
- },
152
- body: JSON.stringify({
153
- model: "grok-beta",
154
- messages: [
155
- { role: "system", content: agent.systemMessage },
156
- { role: "user", content: userPrompt },
157
- ...conversationLog.map((log) => ({
158
- role: "assistant",
159
- content: log.response,
160
- })),
161
- ],
162
- }),
163
- });
164
-
165
- if (!response.ok) {
166
- throw new Error(`Error: ${response.statusText}`);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
167
  }
168
-
169
- const data = await response.json();
170
- const agentResponse = data.choices?.[0]?.message?.content || "Unexpected API response.";
171
- conversationLog.push({
172
- agent: agent.name,
173
- response: agentResponse,
174
- });
175
-
176
- // Append response to content
177
- responseContent.innerHTML += `<strong>${agent.name}:</strong><br>${marked.parse(agentResponse)}<br><hr>`;
178
  }
179
  } catch (error) {
180
  responseContent.textContent = `Error: ${error.message}`;
 
49
  {
50
  name: "Zoe Kim",
51
  systemMessage: `
52
+ You are Zoe Kim, a Software Engineer specializing in full-stack development.
53
+ Start by discussing the application’s development requirements concisely.
54
  `,
55
  },
56
  {
57
  name: "Alex Patel",
58
  systemMessage: `
59
+ You are Alex Patel, a DevOps Engineer focusing on CI/CD pipelines.
60
+ Respond briefly to Zoe’s suggestions, offering infrastructure adjustments.
61
  `,
62
  },
63
  {
64
  name: "Jack Dawson",
65
  systemMessage: `
66
+ You are Jack Dawson, a QA and SRE ensuring system reliability.
67
+ Provide quick feedback on Alex’s pipeline design, addressing risks or gaps.
68
  `,
69
  },
70
  ];
 
142
 
143
  try {
144
  let conversationLog = [];
145
+ const numIterations = 2; // Number of back-and-forth interactions
146
+
147
+ for (let iteration = 0; iteration < numIterations; iteration++) {
148
+ for (const agent of agents) {
149
+ const response = await fetch(`${BASE_URL}/chat/completions`, {
150
+ method: "POST",
151
+ headers: {
152
+ "Authorization": `Bearer ${API_KEY}`,
153
+ "Content-Type": "application/json"
154
+ },
155
+ body: JSON.stringify({
156
+ model: "grok-beta",
157
+ messages: [
158
+ { role: "system", content: agent.systemMessage },
159
+ { role: "user", content: userPrompt },
160
+ ...conversationLog.map((log) => ({
161
+ role: "assistant",
162
+ content: log.response,
163
+ })),
164
+ ],
165
+ }),
166
+ });
167
+
168
+ if (!response.ok) {
169
+ throw new Error(`Error: ${response.statusText}`);
170
+ }
171
+
172
+ const data = await response.json();
173
+ const agentResponse = data.choices?.[0]?.message?.content || "Unexpected API response.";
174
+ conversationLog.push({
175
+ agent: agent.name,
176
+ response: agentResponse,
177
+ });
178
+
179
+ // Append response to content
180
+ responseContent.innerHTML += `<strong>${agent.name}:</strong><br>${marked.parse(agentResponse)}<br><hr>`;
181
  }
 
 
 
 
 
 
 
 
 
 
182
  }
183
  } catch (error) {
184
  responseContent.textContent = `Error: ${error.message}`;