Skip to content

Commit 1a723cf

Browse files
committed
APIAuto: 完成 ASK AI DEEP SEARCH 并优化样式和交互
1 parent 92e35b0 commit 1a723cf

File tree

2 files changed

+16
-4
lines changed
  • APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/resources/static/api

2 files changed

+16
-4
lines changed

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

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

744744
<div class="right-main" id="vHtml" v-show="view == 'html'"></div>
745745
<div class="right-main" id="vMarkdown" v-show="view == 'markdown'"></div>
746-
<div style="bottom: -6px; text-align: right; position: absolute; width: 100%; padding: 4px 20px 0px 4px; background-color: white;">
746+
<div style="bottom: -6px; text-align: right; position: absolute; margin-left: 8px; width: 100%; padding: 4px 20px 0px 4px; background-color: white;">
747747
<!-- <div style="float: right" >-->
748748
<input v-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
<button v-show="view == 'markdown'" @click="pageDown('document')">上页 < </button>
@@ -753,8 +753,10 @@
753753
<input v-show="view == 'markdown'" id="vCount" v-model="count" style="width: 30px;text-align: center" type="number" @keyup="doOnKeyUp(event, 'document', true)" placeholder="条数" />
754754
<a v-show="view == 'markdown'" ></a>
755755
<!-- </div>-->
756-
<input id="vAskAI" style="min-width: 60px; display: inline-flex; padding: 0px 4px 0px 4px" @keyup="doOnKeyUp(event, 'ask', true)" placeholder="Ask AI" :style="{'width': view == 'markdown' ? 'auto' : '82%', 'text-align': view == 'markdown' ? 'center' : 'left'}" />
757-
<label style="float: right; margin-left: 8px; padding-left: 15px; padding-top: 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;"><input id="vDeepSearch" type="checkbox" name="Deep Search" style="height: 100%; text-align: center; position: absolute; margin-left: -15px; bottom: -0px">Deep Search</label>
756+
<div style="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'}">
757+
<textarea id="vAskAI" style="rows: 5; width: 100%; padding: 0px 4px 0px 4px" @keyup="doOnKeyUp(event, 'ask', true)" placeholder="Ask AI, Shift+Enter 换行" ></textarea>
758+
<label style="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;"><input id="vDeepSearch" type="checkbox" name="Deep" >DEEP </label>
759+
</div>
758760
</div>
759761

760762
<ul class="dropdown-menu" id="vOption" style="display: block; left: 0px; top: 0px; max-height: 100%; max-width: 100%; overflow: scroll; overflow-x: scroll; overflow-y:scroll;" v-show="options != null && options.length > 0">
@@ -1053,6 +1055,7 @@
10531055
var vPage = document.getElementById('vPage');
10541056
var vCount = document.getElementById('vCount');
10551057
var vAskAI = document.getElementById('vAskAI');
1058+
var vDeepSearch = document.getElementById('vDeepSearch');
10561059
var vSearch = document.getElementById('vSearch');
10571060
var vTestCasePage = document.getElementById('vTestCasePage');
10581061
var vTestCaseCount = document.getElementById('vTestCaseCount');

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7507,6 +7507,15 @@ Content-Type: ` + contentType) + (StringUtil.isEmpty(headerStr, true) ? '' : hea
75077507

75087508
if (type == 'ask') {
75097509
if (isEnter) {
7510+
event.preventDefault();
7511+
7512+
if (event.shiftKey) {
7513+
vAskAI.value = StringUtil.trim(vAskAI.value) + '\n'
7514+
return
7515+
}
7516+
7517+
vAskAI.value = StringUtil.trim(vAskAI.value)
7518+
75107519
var isRes = false;
75117520
if (StringUtil.isEmpty(vAskAI.value) && StringUtil.isNotEmpty(this.jsoncon, true) ) {
75127521
var res = JSON.parse(this.jsoncon);
@@ -7624,7 +7633,7 @@ Content-Type: ` + contentType) + (StringUtil.isEmpty(headerStr, true) ? '' : hea
76247633
// }
76257634

76267635
this.request(true, REQUEST_TYPE_POST, REQUEST_TYPE_JSON, 'https://api.devin.ai/ada/query', {
7627-
"engine_id": "multihop",
7636+
"engine_id": vDeepSearch.checked ? "agent" : "multihop",
76287637
"user_query": "<relevant_context>" + (isRes ? "这是用 HTTP 接口工具 TommyLemon/APIAuto 发请求后的响应结果,分析并" : "") + "用中文回答:</relevant_context>" + user_query,
76297638
"keywords": [],
76307639
"repo_names": [

0 commit comments

Comments
 (0)