promptlineapp 1.4.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +23 -15
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -1287,28 +1287,35 @@ export default function DevAdminPage() {
|
|
|
1287
1287
|
|
|
1288
1288
|
const testConnection = async () => {
|
|
1289
1289
|
if (!endpoint) return
|
|
1290
|
+
if (!apiKey) {
|
|
1291
|
+
setStatus('error')
|
|
1292
|
+
addLog('error', 'API Key required for health check')
|
|
1293
|
+
return
|
|
1294
|
+
}
|
|
1290
1295
|
setStatus('testing')
|
|
1291
1296
|
const proxyUrl = toProxyUrl(endpoint)
|
|
1292
|
-
|
|
1293
|
-
|
|
1297
|
+
// Use /isAlive endpoint for health check (no LLM execution, no token consumption)
|
|
1298
|
+
const isAliveUrl = proxyUrl + '/isAlive'
|
|
1299
|
+
addLog('info', 'Testing connection (isAlive)...', { endpoint: isAliveUrl, original: endpoint })
|
|
1294
1300
|
|
|
1295
1301
|
const startTime = Date.now()
|
|
1296
1302
|
try {
|
|
1297
|
-
const res = await fetch(
|
|
1298
|
-
method: '
|
|
1303
|
+
const res = await fetch(isAliveUrl, {
|
|
1304
|
+
method: 'GET',
|
|
1299
1305
|
headers: {
|
|
1300
|
-
'
|
|
1301
|
-
|
|
1302
|
-
},
|
|
1303
|
-
body: JSON.stringify({ input: { text: 'test' }, variables: {} })
|
|
1306
|
+
'X-API-Key': apiKey
|
|
1307
|
+
}
|
|
1304
1308
|
})
|
|
1309
|
+
const data = await res.json().catch(() => ({}))
|
|
1305
1310
|
const duration = Date.now() - startTime
|
|
1306
1311
|
|
|
1307
|
-
if (res.ok) {
|
|
1312
|
+
if (res.ok && data.alive === true) {
|
|
1308
1313
|
setStatus('connected')
|
|
1309
|
-
addLog('success', '
|
|
1314
|
+
addLog('success', 'Endpoint is alive (' + duration + 'ms)', { alive: true })
|
|
1315
|
+
} else if (res.ok && data.alive === false) {
|
|
1316
|
+
setStatus('error')
|
|
1317
|
+
addLog('error', 'Endpoint exists but is inactive (' + duration + 'ms)', { alive: false })
|
|
1310
1318
|
} else {
|
|
1311
|
-
const data = await res.json().catch(() => ({}))
|
|
1312
1319
|
setStatus('error')
|
|
1313
1320
|
addLog('error', res.status + ' ' + res.statusText + ' (' + duration + 'ms)', data)
|
|
1314
1321
|
}
|
|
@@ -1317,7 +1324,7 @@ export default function DevAdminPage() {
|
|
|
1317
1324
|
setStatus('error')
|
|
1318
1325
|
addLog('error', 'Network error (' + duration + 'ms)', {
|
|
1319
1326
|
message: err.message,
|
|
1320
|
-
hint: err.message.includes('Failed to fetch') ? 'CORS issue
|
|
1327
|
+
hint: err.message.includes('Failed to fetch') ? 'CORS issue or endpoint not found' : null
|
|
1321
1328
|
})
|
|
1322
1329
|
}
|
|
1323
1330
|
}
|
|
@@ -1410,7 +1417,7 @@ export default function DevAdminPage() {
|
|
|
1410
1417
|
className="w-full bg-gray-700 p-3 rounded text-white font-mono text-sm"
|
|
1411
1418
|
placeholder="Your API key..."
|
|
1412
1419
|
/>
|
|
1413
|
-
<p className="text-xs text-gray-500 mt-1">
|
|
1420
|
+
<p className="text-xs text-gray-500 mt-1">Required for health check. Get from /api-keys</p>
|
|
1414
1421
|
</div>
|
|
1415
1422
|
|
|
1416
1423
|
<div className="flex gap-3">
|
|
@@ -1423,10 +1430,11 @@ export default function DevAdminPage() {
|
|
|
1423
1430
|
</button>
|
|
1424
1431
|
<button
|
|
1425
1432
|
onClick={testConnection}
|
|
1426
|
-
disabled={!endpoint || status === 'testing'}
|
|
1433
|
+
disabled={!endpoint || !apiKey || status === 'testing'}
|
|
1427
1434
|
className="px-6 py-2 bg-gray-600 rounded font-medium hover:bg-gray-500 disabled:opacity-50 flex items-center gap-2"
|
|
1435
|
+
title="Uses /isAlive endpoint (no LLM cost)"
|
|
1428
1436
|
>
|
|
1429
|
-
{status === 'testing' ? '
|
|
1437
|
+
{status === 'testing' ? 'Checking...' : 'Check Health'}
|
|
1430
1438
|
{status === 'connected' && <span className="text-green-400">●</span>}
|
|
1431
1439
|
{status === 'error' && <span className="text-red-400">●</span>}
|
|
1432
1440
|
</button>
|