Skip to content

Commit bbe58b7

Browse files
authored
Merge pull request #54 from huliang2016/master
support depth search
2 parents 9f2e172 + db50132 commit bbe58b7

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/api/controllers/chat.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ async function removeConversation(convId: string, ticket: string) {
8080
async function createCompletion(
8181
model = MODEL_NAME,
8282
messages: any[],
83+
searchType: string = '',
8384
ticket: string,
8485
refConvId = '',
8586
retryCount = 0
@@ -129,7 +130,8 @@ async function createCompletion(
129130
sessionType: "text_chat",
130131
parentMsgId,
131132
params: {
132-
"fileUploadBatchId": util.uuid()
133+
"fileUploadBatchId": util.uuid(),
134+
"searchType": searchType,
133135
},
134136
contents: messagesPrepare(messages, refs, !!refConvId),
135137
})
@@ -173,6 +175,7 @@ async function createCompletion(
173175
async function createCompletionStream(
174176
model = MODEL_NAME,
175177
messages: any[],
178+
searchType: string = '',
176179
ticket: string,
177180
refConvId = '',
178181
retryCount = 0
@@ -220,7 +223,8 @@ async function createCompletionStream(
220223
sessionType: "text_chat",
221224
parentMsgId,
222225
params: {
223-
"fileUploadBatchId": util.uuid()
226+
"fileUploadBatchId": util.uuid(),
227+
"searchType": searchType,
224228
},
225229
contents: messagesPrepare(messages, refs, !!refConvId),
226230
})

src/api/routes/chat.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ export default {
1717
const tokens = chat.tokenSplit(request.headers.authorization);
1818
// 随机挑选一个ticket
1919
const token = _.sample(tokens);
20-
const { model, conversation_id: convId, messages, stream } = request.body;
20+
const { model, conversation_id: convId, messages, search_type, stream } = request.body;
2121
if (stream) {
2222
const stream = await chat.createCompletionStream(
2323
model,
2424
messages,
25+
search_type,
2526
token,
2627
convId
2728
);
@@ -32,6 +33,7 @@ export default {
3233
return await chat.createCompletion(
3334
model,
3435
messages,
36+
search_type,
3537
token,
3638
convId
3739
);

0 commit comments

Comments
 (0)