div0-space commited on
Commit
f55ee23
·
verified ·
1 Parent(s): d55af21

Add lane API key + image URL fields

Browse files
Files changed (1) hide show
  1. api-tester.html +36 -8
api-tester.html CHANGED
@@ -464,6 +464,12 @@
464
  display: none;
465
  }
466
 
 
 
 
 
 
 
467
  .notice {
468
  margin: 0 0 1rem 0;
469
  padding: 0.75rem 1rem;
@@ -925,7 +931,15 @@
925
  </div>
926
  <div class="field">
927
  <label>System Prompt (optional)</label>
928
- <textarea id="${laneId}-system" placeholder="Jesteś pomocnym asystentem..."></textarea>
 
 
 
 
 
 
 
 
929
  </div>
930
  </div>
931
 
@@ -1088,7 +1102,9 @@
1088
 
1089
  for (let step = 1; step <= chainCount; step++) {
1090
  const prompt = document.getElementById(`${laneId}-prompt-${step}`).value;
1091
- if (!prompt.trim()) continue;
 
 
1092
 
1093
  // Create output item
1094
  const outputItem = document.createElement('div');
@@ -1110,6 +1126,7 @@
1110
  endpoint,
1111
  model,
1112
  prompt,
 
1113
  systemPrompt,
1114
  apiKey,
1115
  isStream,
@@ -1139,7 +1156,7 @@
1139
  }
1140
  }
1141
 
1142
- async function executeRequest({ endpoint, model, prompt, systemPrompt, apiKey, isStream, previousResponseId, laneId, step }) {
1143
  const outputEl = document.getElementById(`${laneId}-output-${step}`);
1144
  const previewEl = document.getElementById(`${laneId}-preview-${step}`);
1145
 
@@ -1155,10 +1172,16 @@
1155
  if (systemPrompt) {
1156
  input.push({ role: 'system', content: systemPrompt });
1157
  }
1158
- input.push({
1159
- role: 'user',
1160
- content: [{ type: 'input_text', text: prompt }]
1161
- });
 
 
 
 
 
 
1162
 
1163
  body = { model, input, stream: isStream };
1164
  if (previousResponseId) {
@@ -1170,7 +1193,12 @@
1170
  if (systemPrompt) {
1171
  messages.push({ role: 'system', content: systemPrompt });
1172
  }
1173
- messages.push({ role: 'user', content: prompt });
 
 
 
 
 
1174
 
1175
  body = { model, messages, stream: isStream };
1176
  }
 
464
  display: none;
465
  }
466
 
467
+ .image-input {
468
+ margin-top: 0.35rem;
469
+ font-size: 0.8rem;
470
+ color: var(--text-dim);
471
+ }
472
+
473
  .notice {
474
  margin: 0 0 1rem 0;
475
  padding: 0.75rem 1rem;
 
931
  </div>
932
  <div class="field">
933
  <label>System Prompt (optional)</label>
934
+ <textarea id="${laneId}-system" placeholder="You are a helpful assistant..."></textarea>
935
+ </div>
936
+ <div class="field">
937
+ <label>Lane API Key (overrides global)</label>
938
+ <input type="password" id="${laneId}-apiKey" placeholder="optional lane key">
939
+ </div>
940
+ <div class="field">
941
+ <label>Image URL (optional for multimodal)</label>
942
+ <input type="text" id="${laneId}-image-url" class="image-input" placeholder="https://.../image.jpg">
943
  </div>
944
  </div>
945
 
 
1102
 
1103
  for (let step = 1; step <= chainCount; step++) {
1104
  const prompt = document.getElementById(`${laneId}-prompt-${step}`).value;
1105
+ const imageUrlInput = document.getElementById(`${laneId}-image-url`);
1106
+ const imageUrl = imageUrlInput ? imageUrlInput.value.trim() : '';
1107
+ if (!prompt.trim() && !imageUrl) continue;
1108
 
1109
  // Create output item
1110
  const outputItem = document.createElement('div');
 
1126
  endpoint,
1127
  model,
1128
  prompt,
1129
+ imageUrl,
1130
  systemPrompt,
1131
  apiKey,
1132
  isStream,
 
1156
  }
1157
  }
1158
 
1159
+ async function executeRequest({ endpoint, model, prompt, imageUrl, systemPrompt, apiKey, isStream, previousResponseId, laneId, step }) {
1160
  const outputEl = document.getElementById(`${laneId}-output-${step}`);
1161
  const previewEl = document.getElementById(`${laneId}-preview-${step}`);
1162
 
 
1172
  if (systemPrompt) {
1173
  input.push({ role: 'system', content: systemPrompt });
1174
  }
1175
+
1176
+ const userContent = [];
1177
+ if (prompt) {
1178
+ userContent.push({ type: 'input_text', text: prompt });
1179
+ }
1180
+ if (imageUrl) {
1181
+ userContent.push({ type: 'input_image', image_url: { url: imageUrl } });
1182
+ }
1183
+
1184
+ input.push({ role: 'user', content: userContent });
1185
 
1186
  body = { model, input, stream: isStream };
1187
  if (previousResponseId) {
 
1193
  if (systemPrompt) {
1194
  messages.push({ role: 'system', content: systemPrompt });
1195
  }
1196
+
1197
+ const userContent = [];
1198
+ if (prompt) userContent.push({ type: 'text', text: prompt });
1199
+ if (imageUrl) userContent.push({ type: 'image_url', image_url: { url: imageUrl } });
1200
+
1201
+ messages.push({ role: 'user', content: userContent });
1202
 
1203
  body = { model, messages, stream: isStream };
1204
  }