@@ -7514,20 +7514,51 @@ Content-Type: ` + contentType) + (StringUtil.isEmpty(headerStr, true) ? '' : hea
7514
7514
return
7515
7515
}
7516
7516
7517
- vAskAI.value = StringUtil.trim(vAskAI.value)
7517
+ var query = vAskAI.value = StringUtil.trim(vAskAI.value)
7518
7518
7519
7519
var isRes = false;
7520
- if (StringUtil.isEmpty(vAskAI.value) && StringUtil.isNotEmpty(this.jsoncon, true) ) {
7521
- var res = JSON.parse(this.jsoncon);
7520
+
7521
+ if (StringUtil.isEmpty(query)) {
7522
+ var view = this.view;
7523
+ var isCode = view == 'code'
7524
+
7525
+ // 太长 var output = view == 'error' || view == 'output' ? this.output : null;
7526
+ var output = view == 'error' ? this.output : null;
7527
+ var d = view == 'markdown' || view == 'html' ? doc : null;
7528
+
7529
+ var res = isCode ? JSON.parse(this.jsoncon) : null;
7522
7530
// res = this.removeDebugInfo(res);
7523
- delete res['trace:stack']
7524
- delete res['debug:info|help']
7525
- vAskAI.value = JSON.stringify(res)
7531
+ if (JSONResponse.isObject(res)) {
7532
+ delete res['trace:stack']
7533
+ delete res['debug:info|help']
7534
+ }
7535
+ var resStr = res == null ? null : JSON.stringify(res)
7536
+
7537
+ var headers = isCode ? (this.currentHttpResponse || {}).headers : null
7538
+ var headerStr = ''
7539
+ if (headers != null) {
7540
+ for (var k in headers) {
7541
+ var v = headers[k];
7542
+ headerStr += '\n' + k + ': ' + StringUtil.get(v);
7543
+ }
7544
+ }
7545
+
7546
+ vAskAI.value = "### Request:\n" + this.method + " " + this.type + " " + this.getUrl()
7547
+ + (StringUtil.isEmpty(vHeader.value) ? '' : "\n" + StringUtil.trim(vHeader.value))
7548
+ + (StringUtil.isEmpty(vInput.value) ? '' : "\n\n```js\n" + StringUtil.trim(vInput.value) + '\n```')
7549
+ + (isCode ? "\n\n### Response: " : '')
7550
+ + (StringUtil.isEmpty(headerStr) ? '' : '\n' + StringUtil.trim(headerStr))
7551
+ + (StringUtil.isEmpty(resStr) ? '' : "\n\n```js\n" + resStr + '\n```')
7552
+ + (StringUtil.isEmpty(vAskAI.value) ? '' : '\n\n' + StringUtil.trim(vAskAI.value)) + '\n'
7553
+ + (StringUtil.isEmpty(output) ? '' : '\n\n### 提示信息: \n' + StringUtil.trim(output))
7554
+ // 太长 + (StringUtil.isEmpty(d) ? '' : '\n\n### 文档: \n' + d)
7555
+ + '\n'
7526
7556
isRes = true;
7527
7557
}
7528
7558
7529
7559
const user_query = StringUtil.trim(vAskAI.value);
7530
7560
if (StringUtil.isEmpty(user_query)) {
7561
+ alert('请输入问题!')
7531
7562
return;
7532
7563
}
7533
7564
@@ -7634,11 +7665,11 @@ Content-Type: ` + contentType) + (StringUtil.isEmpty(headerStr, true) ? '' : hea
7634
7665
7635
7666
this.request(true, REQUEST_TYPE_POST, REQUEST_TYPE_JSON, 'https://api.devin.ai/ada/query', {
7636
7667
"engine_id": vDeepSearch.checked ? "agent" : "multihop",
7637
- "user_query": "<relevant_context>" + (isRes ? "这是用 HTTP 接口工具 TommyLemon/APIAuto 发请求后的响应结果,分析并" : "") + "用中文回答:</relevant_context>" + user_query,
7668
+ "user_query": "<relevant_context>" + (isRes ? "这是用 HTTP 接口工具 TommyLemon/APIAuto 发请求后的响应结果,分析并" : "") + "用中文回答:</relevant_context><br/>\n " + user_query,
7638
7669
"keywords": [],
7639
- "repo_names": [
7670
+ "repo_names":JSONObject.isAPIJSONPath(this.getMethod()) ? [
7640
7671
"Tencent/APIJSON", "TommyLemon/APIAuto"
7641
- ],
7672
+ ] : ["TommyLemon/APIAuto"] ,
7642
7673
"additional_context": "",
7643
7674
"query_id": this.uuid,
7644
7675
"use_notes": false,
@@ -8139,7 +8170,7 @@ Content-Type: ` + contentType) + (StringUtil.isEmpty(headerStr, true) ? '' : hea
8139
8170
break;
8140
8171
8141
8172
case CodeUtil.LANGUAGE_PYTHON:
8142
- s += '\n#### <= Web-Python: 注释符用 \'\#\''
8173
+ s += '\n#### <= Web-Python: 注释符用 \'\\ #\''
8143
8174
+ ' \n ```python \n'
8144
8175
+ CodeUtil.parsePythonRequest(null, parseJSON(rq), 0, isSingle, vInput.value)
8145
8176
+ '\n ``` \n注:关键词转换 null: None, false: False, true: True';