Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitff995a4

Browse files
committed
Demo: MultiDataSource 完善 APIAuto 中 AI 问答在无内容时的自动填充
1 parent1464073 commitff995a4

File tree

3 files changed

+66
-14
lines changed

3 files changed

+66
-14
lines changed

‎APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/resources/static/api/README.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@
1616

1717
---
1818
敏捷开发最强大易用的 HTTP 接口工具,机器学习零代码测试、生成代码与静态检查、生成文档与光标悬浮注释。<br />
19-
文档、测试、Mock、调试、管理于一体的一站式体验,还有一键格式化、注释/取消注释等高效易用的快捷键。<br />
19+
集合 文档、测试、Mock、调试、管理的一站式体验,还有**AI 问答** 和一键格式化、注释/取消注释等高效快捷键。<br />
2020
在常用功能上远超 Postman, Swagger, YApi 等各种 开源、商业 的 API 文档/测试 工具,并能一键导入用例和文档。<br />
2121
支持 GET, POST, PUT, PATCH, DELETE, HEAD 等各种 HTTP Method 及 Content-Type, URL /{Path}/{Variable}。<br />
2222
不仅适用于 RESTful、类 RESTful、GRPC 的 API,还是腾讯[APIJSON](https://github.com/Tencent/APIJSON) 官方建议的文档与测试工具。<br />
2323
腾讯内部用户包括 IEG 互动娱乐事业群、TEG 技术工程事业群、CSIG 云与智慧事业群 的多个部门及团队, <br />
2424
外部用户包含 华为、工商银行某地分行、500 强上市公司传音、跨境电商巨头 SHEIN、行业领头羊社保科技 等。
2525

26+
![image](https://github.com/user-attachments/assets/24460af3-0001-46e7-aa2a-df28b711a8cf)
2627
![](https://user-images.githubusercontent.com/5738175/145665502-94231804-5ea8-4784-b30d-d5558aad0f8d.jpeg)
2728

2829
<h3align="center"style="text-align:center;">
@@ -115,7 +116,9 @@ Bilibili:https://search.bilibili.com/all?keyword=APIAuto
115116

116117

117118
###相关推荐
118-
[别再生成测试代码了!](https://mp.weixin.qq.com/s/G1GVNhhFbSX5GoyRU6GURg)
119+
[别再生成测试代码了!](https://mp.weixin.qq.com/s/G1GVNhhFbSX5GoyRU6GURg) <br />
120+
[APIAuto: 最先进的HTTP接口工具](https://blog.csdn.net/Nifc666/article/details/141966487)
121+
119122

120123
###百度、搜狗、抖音公网接口调用演示<br />
121124
因为这些接口不支持 CORS 跨域,所以需要开启托管服务代理。<br />
@@ -252,6 +255,24 @@ https://github.com/TommyLemon/APIAuto/issues
252255

253256
<br />
254257

258+
###Roadmap 路线图
259+
1.Translate document to English/Italian/Franch/Spanish... <br />
260+
261+
2.新增功能 <br />
262+
1) 断言结果 新增按钮 变-\{原因},点击后右侧展示 JSON diff view; <br />
263+
2) 右下角列表展示具体每个断言有问题的字段,点击后 JSON view 只显示该字段对应值 <br />
264+
其他待补充... <br />
265+
<br />
266+
3.完善自动断言,支持更多格式的匹配 <br />
267+
<br />
268+
4.解决 bug <br />
269+
<br />
270+
5.提升性能 <br />
271+
<br />
272+
6.其他待补充... <br />
273+
274+
<br />
275+
255276
###感谢开源
256277
* jsonon
257278
* editor.md

‎APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/resources/static/api/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@
743743

744744
<divclass="right-main"id="vHtml"v-show="view == 'html'"></div>
745745
<divclass="right-main"id="vMarkdown"v-show="view == 'markdown'"></div>
746-
<divstyle="bottom: -6px; text-align: right; position: absolute; margin-left: 8px; width: 100%; padding: 4px 20px 0px 4px; background-color: white;">
746+
<divstyle="bottom: -8px; text-align: right; position: absolute; margin-left: 8px; width: 100%; padding: 4px 20px 0px 4px; background-color: white;">
747747
<!-- <div style="float: right" >-->
748748
<inputv-show="view == 'markdown'"id="vSearch"v-model="search"style="min-width: 60px; display: inline-flex; text-align: center"@keyup="doOnKeyUp(event, 'document', true)"placeholder="搜索文档"/>
749749
<buttonv-show="view == 'markdown'"@click="pageDown('document')">上页<</button>
@@ -753,7 +753,7 @@
753753
<inputv-show="view == 'markdown'"id="vCount"v-model="count"style="width: 30px;text-align: center"type="number"@keyup="doOnKeyUp(event, 'document', true)"placeholder="条数"/>
754754
<av-show="view == 'markdown'"></a>
755755
<!-- </div>-->
756-
<divstyle="display: inline-flex; border: black 1px solid; border-radius: 2px; float: right; margin-left: 8px; padding-left: 3px; padding-top: 3px;":style="{'width': view == 'markdown' ? 'auto' : '100%', 'height': view == 'markdown' ? '27px' : 'auto'}">
756+
<divstyle="display: inline-flex; border: black 1px solid; border-radius: 2px; float: right; margin-left: 8px; padding-left: 3px; padding-top: 3px;":style="{'width': view == 'markdown' ? 'auto' : '100%', 'height': view == 'markdown' ? '27px' : '27px'}">
757757
<textareaid="vAskAI"style="rows: 5; width: 100%; padding: 0px 4px 0px 4px"@keyup="doOnKeyUp(event, 'ask', true)"placeholder="Ask AI, Shift+Enter 换行"></textarea>
758758
<labelstyle="top: -2px; height: 27px; width: 60px; margin-left: 3px; margin-right: 3px; justify-content: center; align-items: center; text-align: center; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none;"><inputid="vDeepSearch"type="checkbox"name="Deep">DEEP</label>
759759
</div>

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

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp