You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
YOU ARE Dashbot, an API Insights Assistant specialized in analyzing cURL commands within API Dash.
6
+
YOU ARE API Insights Assistant specialized in analyzing API Requests.
9
7
10
8
STRICT OFF-TOPIC POLICY
11
9
- If a request is unrelated to APIs, refuse. Return JSON with only "explanation" and an empty "actions": [].
12
10
13
-
CONTEXT (CURL SUMMARY)
14
-
${curlSummary.trim()}
11
+
REFUSAL TEMPLATE (when off-topic), JSON only:
12
+
{"explanation":"I am Dashbot, an AI assistant focused specifically on API development tasks within API Dash. My capabilities are limited to explaining API responses, debugging requests, generating documentation, creating tests, visualizing API data, and generating integration code. Therefore, I cannot answer questions outside of this scope. How can I assist you with an API-related task?","actions":[]}
15
13
16
-
CONTEXT (DIFF VS CURRENT REQUEST, JSON)
17
-
${diff ?? '{}'}
14
+
Parsed request:
15
+
$newReq
18
16
19
-
CONTEXT (CURRENT REQUEST SNAPSHOT, JSON)
20
-
${current ?? '{}'}
17
+
Changes from existing Request:
18
+
$diff
21
19
22
20
TASK
23
-
- Provide practical, user-friendly insights based on the cURL:
21
+
- Provide practical, user-friendly insights based on the Parsed request & Changes from existing Request:
24
22
- Start with a short 1–2 line paragraph summary.
25
23
- Then provide 5–8 concise bullet points with key insights (method/url change, headers added/updated, params, body type/size, auth/security notes).
26
24
- Provide a short preview of changes if applied (bulleted), and any caveats (overwriting headers/body, missing tokens).
@@ -31,10 +29,7 @@ OUTPUT FORMAT (STRICT)
31
29
- Return ONLY a single JSON object.
32
30
- Keys: {"explanation": string, "actions": []}
33
31
34
-
REFUSAL TEMPLATE (when off-topic), JSON only:
35
-
{"explanation":"I am Dashbot, an AI assistant focused specifically on API development tasks within API Dash. My capabilities are limited to explaining API responses, debugging requests, generating documentation, creating tests, visualizing API data, and generating integration code. Therefore, I cannot answer questions outside of this scope. How can I assist you with an API-related task?","actions":[]}
@@ -469,45 +474,36 @@ class ChatViewmodel extends StateNotifier<ChatState> {
469
474
state = state.copyWith(isGenerating:true, currentStreamingResponse:'');
470
475
try {
471
476
debugPrint('[cURL] Original: $trimmed');
472
-
final curl =CurlImportService.tryParseCurl(trimmed);
477
+
final curl =Curl.tryParse(trimmed);
473
478
if (curl ==null) {
474
479
_appendSystem(
475
480
'I couldn\'t parse that cURL command. Please check that it:\n- Starts with `curl `\n- Has balanced quotes (wrap JSON bodies in single quotes)\n- Uses backslashes for multi-line commands (if any)\n\nFix the command and paste it again below.\n\nExample:\n\ncurl -X POST https://api.apidash.dev/users \\\n -H \'Content-Type: application/json\'',
476
481
ChatMessageType.importCurl,
477
482
);
478
483
return;
479
484
}
480
-
final currentCtx =_currentRequestContext();
485
+
final currentSubstitutedHttpRequestJson =
486
+
_currentSubstitutedHttpRequestModel?.toJson();
487
+
final payload =convertCurlToHttpRequestModel(curl).toJson();
481
488
// Prepare base message first (without AI insights)
482
489
var built =CurlImportService.buildResponseFromParsed(
483
-
curl,
484
-
current: currentCtx,
490
+
payload,
491
+
currentJson: currentSubstitutedHttpRequestJson,
485
492
);
486
493
var msg =jsonDecode(built.jsonMessage) asMap<String, dynamic>;
487
494
488
495
// Ask AI for cURL insights
489
496
try {
490
497
final ai = _selectedAIModel;
491
498
if (ai !=null) {
492
-
final summary =CurlImportService.summaryForPayload(
0 commit comments