Skip to content

Commit c0288fe

Browse files
committed
APIAuto: 解决 AI 问答在列表显示断言结果时仍然用请求输入框的 URL, JSON 等信息提问
1 parent 75c6d7f commit c0288fe

File tree

1 file changed

+29
-1
lines changed
  • APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/resources/static/api/js

1 file changed

+29
-1
lines changed

APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/resources/static/api/js/main.js

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7543,7 +7543,21 @@ Content-Type: ` + contentType) + (StringUtil.isEmpty(headerStr, true) ? '' : hea
75437543
}
75447544
}
75457545

7546-
vAskAI.value = "### Request:\n" + this.method + " " + this.type + " " + this.getUrl()
7546+
var curItem = (this.isTestCaseShow != true ? this.currentRandomItem : this.remotes[this.currentDocIndex]) || {}
7547+
var curDoc = curItem.Document || {}
7548+
var curRecord = curItem.TestRecord || {}
7549+
var curRandom = curItem.Random || {}
7550+
7551+
// var isRandom = this.isTestCaseShow != true && this.isRandomShow == true
7552+
// var tests = this.tests[String(this.currentAccountIndex)] || {}
7553+
// var currentResponse = (tests[isRandom ? random.documentId : document.id] || {})[
7554+
// isRandom ? (random.id > 0 ? random.id : (random.toId + '' + random.id)) : 0
7555+
// ]
7556+
//
7557+
// resStr = currentResponse != null ? JSON.stringify(currentResponse) : curRecord.response;
7558+
7559+
if (this.isTestCaseShow != true) {
7560+
vAskAI.value = "### Request:\n" + this.method + " " + this.type + " " + this.getUrl()
75477561
+ (StringUtil.isEmpty(vHeader.value) ? '' : "\n" + StringUtil.trim(vHeader.value))
75487562
+ (StringUtil.isEmpty(vInput.value) ? '' : "\n\n```js\n" + StringUtil.trim(vInput.value) + '\n```')
75497563
+ (isCode ? "\n\n### Response: " : '')
@@ -7553,6 +7567,19 @@ Content-Type: ` + contentType) + (StringUtil.isEmpty(headerStr, true) ? '' : hea
75537567
+ (StringUtil.isEmpty(output) ? '' : '\n\n### 提示信息: \n' + StringUtil.trim(output))
75547568
// 太长 + (StringUtil.isEmpty(d) ? '' : '\n\n### 文档: \n' + d)
75557569
+ '\n'
7570+
} else {
7571+
vAskAI.value = "### Request:\n" + curDoc.method + " " + curDoc.type + " " + (this.getBaseUrl() + curDoc.url)
7572+
+ (StringUtil.isEmpty(curDoc.header) ? '' : "\n" + StringUtil.trim(curDoc.header))
7573+
+ (StringUtil.isEmpty(curDoc.request) ? '' : "\n\n```js\n" + StringUtil.trim(curDoc.request) + '\n```')
7574+
+ (isCode ? "\n\n### Response: " : '')
7575+
+ (StringUtil.isEmpty(curRecord.header) ? '' : '\n' + StringUtil.trim(curRecord.header))
7576+
+ (StringUtil.isEmpty(resStr) ? '' : "\n\n```js\n" + resStr + '\n```')
7577+
+ (StringUtil.isEmpty(vAskAI.value) ? '' : '\n\n' + StringUtil.trim(vAskAI.value)) + '\n'
7578+
+ (StringUtil.isEmpty(output) ? '' : '\n\n### 提示信息: \n' + StringUtil.trim(output))
7579+
// 太长 + (StringUtil.isEmpty(d) ? '' : '\n\n### 文档: \n' + d)
7580+
+ '\n'
7581+
}
7582+
75567583
isRes = true;
75577584
}
75587585

@@ -7664,6 +7691,7 @@ Content-Type: ` + contentType) + (StringUtil.isEmpty(headerStr, true) ? '' : hea
76647691
this.uuid = crypto.randomUUID();
76657692
} catch (e) {
76667693
console.error('Failed to generate UUID:', e);
7694+
this.uuid = '';
76677695
}
76687696

76697697
if (StringUtil.isEmpty(this.uuid, true)) {

0 commit comments

Comments
 (0)