Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support depth search #54

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/api/controllers/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ async function removeConversation(convId: string, ticket: string) {
async function createCompletion(
model = MODEL_NAME,
messages: any[],
searchType: string = '',
ticket: string,
refConvId = '',
retryCount = 0
Expand Down Expand Up @@ -129,7 +130,8 @@ async function createCompletion(
sessionType: "text_chat",
parentMsgId,
params: {
"fileUploadBatchId": util.uuid()
"fileUploadBatchId": util.uuid(),
"searchType": searchType,
},
contents: messagesPrepare(messages, refs, !!refConvId),
})
Expand Down Expand Up @@ -173,6 +175,7 @@ async function createCompletion(
async function createCompletionStream(
model = MODEL_NAME,
messages: any[],
searchType: string = '',
ticket: string,
refConvId = '',
retryCount = 0
Expand Down Expand Up @@ -220,7 +223,8 @@ async function createCompletionStream(
sessionType: "text_chat",
parentMsgId,
params: {
"fileUploadBatchId": util.uuid()
"fileUploadBatchId": util.uuid(),
"searchType": searchType,
},
contents: messagesPrepare(messages, refs, !!refConvId),
})
Expand Down
4 changes: 3 additions & 1 deletion src/api/routes/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ export default {
const tokens = chat.tokenSplit(request.headers.authorization);
// 随机挑选一个ticket
const token = _.sample(tokens);
const { model, conversation_id: convId, messages, stream } = request.body;
const { model, conversation_id: convId, messages, search_type, stream } = request.body;
if (stream) {
const stream = await chat.createCompletionStream(
model,
messages,
search_type,
token,
convId
);
Expand All @@ -32,6 +33,7 @@ export default {
return await chat.createCompletion(
model,
messages,
search_type,
token,
convId
);
Expand Down