@@ -7514,20 +7514,51 @@ Content-Type: ` + contentType) + (StringUtil.isEmpty(headerStr, true) ? '' : hea
75147514 return
75157515 }
75167516
7517- vAskAI.value = StringUtil.trim(vAskAI.value)
7517+ var query = vAskAI.value = StringUtil.trim(vAskAI.value)
75187518
75197519 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;
75227530// 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'
75267556 isRes = true;
75277557 }
75287558
75297559 const user_query = StringUtil.trim(vAskAI.value);
75307560 if (StringUtil.isEmpty(user_query)) {
7561+ alert('请输入问题!')
75317562 return;
75327563 }
75337564
@@ -7634,11 +7665,11 @@ Content-Type: ` + contentType) + (StringUtil.isEmpty(headerStr, true) ? '' : hea
76347665
76357666 this.request(true, REQUEST_TYPE_POST, REQUEST_TYPE_JSON, 'https://api.devin.ai/ada/query', {
76367667 "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,
76387669 "keywords": [],
7639- "repo_names": [
7670+ "repo_names": JSONObject.isAPIJSONPath(this.getMethod()) ? [
76407671 "Tencent/APIJSON", "TommyLemon/APIAuto"
7641- ],
7672+ ] : ["TommyLemon/APIAuto"] ,
76427673 "additional_context": "",
76437674 "query_id": this.uuid,
76447675 "use_notes": false,
@@ -8139,7 +8170,7 @@ Content-Type: ` + contentType) + (StringUtil.isEmpty(headerStr, true) ? '' : hea
81398170 break;
81408171
81418172 case CodeUtil.LANGUAGE_PYTHON:
8142- s += '\n#### <= Web-Python: 注释符用 \'\#\''
8173+ s += '\n#### <= Web-Python: 注释符用 \'\\ #\''
81438174 + ' \n ```python \n'
81448175 + CodeUtil.parsePythonRequest(null, parseJSON(rq), 0, isSingle, vInput.value)
81458176 + '\n ``` \n注:关键词转换 null: None, false: False, true: True';
0 commit comments