mirror of
https://github.com/LLM-Red-Team/qwen-free-api.git
synced 2025-01-24 08:51:31 +08:00
commit
bbe58b70fe
@ -80,6 +80,7 @@ async function removeConversation(convId: string, ticket: string) {
|
|||||||
async function createCompletion(
|
async function createCompletion(
|
||||||
model = MODEL_NAME,
|
model = MODEL_NAME,
|
||||||
messages: any[],
|
messages: any[],
|
||||||
|
searchType: string = '',
|
||||||
ticket: string,
|
ticket: string,
|
||||||
refConvId = '',
|
refConvId = '',
|
||||||
retryCount = 0
|
retryCount = 0
|
||||||
@ -129,7 +130,8 @@ async function createCompletion(
|
|||||||
sessionType: "text_chat",
|
sessionType: "text_chat",
|
||||||
parentMsgId,
|
parentMsgId,
|
||||||
params: {
|
params: {
|
||||||
"fileUploadBatchId": util.uuid()
|
"fileUploadBatchId": util.uuid(),
|
||||||
|
"searchType": searchType,
|
||||||
},
|
},
|
||||||
contents: messagesPrepare(messages, refs, !!refConvId),
|
contents: messagesPrepare(messages, refs, !!refConvId),
|
||||||
})
|
})
|
||||||
@ -173,6 +175,7 @@ async function createCompletion(
|
|||||||
async function createCompletionStream(
|
async function createCompletionStream(
|
||||||
model = MODEL_NAME,
|
model = MODEL_NAME,
|
||||||
messages: any[],
|
messages: any[],
|
||||||
|
searchType: string = '',
|
||||||
ticket: string,
|
ticket: string,
|
||||||
refConvId = '',
|
refConvId = '',
|
||||||
retryCount = 0
|
retryCount = 0
|
||||||
@ -220,7 +223,8 @@ async function createCompletionStream(
|
|||||||
sessionType: "text_chat",
|
sessionType: "text_chat",
|
||||||
parentMsgId,
|
parentMsgId,
|
||||||
params: {
|
params: {
|
||||||
"fileUploadBatchId": util.uuid()
|
"fileUploadBatchId": util.uuid(),
|
||||||
|
"searchType": searchType,
|
||||||
},
|
},
|
||||||
contents: messagesPrepare(messages, refs, !!refConvId),
|
contents: messagesPrepare(messages, refs, !!refConvId),
|
||||||
})
|
})
|
||||||
|
@ -17,11 +17,12 @@ export default {
|
|||||||
const tokens = chat.tokenSplit(request.headers.authorization);
|
const tokens = chat.tokenSplit(request.headers.authorization);
|
||||||
// 随机挑选一个ticket
|
// 随机挑选一个ticket
|
||||||
const token = _.sample(tokens);
|
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) {
|
if (stream) {
|
||||||
const stream = await chat.createCompletionStream(
|
const stream = await chat.createCompletionStream(
|
||||||
model,
|
model,
|
||||||
messages,
|
messages,
|
||||||
|
search_type,
|
||||||
token,
|
token,
|
||||||
convId
|
convId
|
||||||
);
|
);
|
||||||
@ -32,6 +33,7 @@ export default {
|
|||||||
return await chat.createCompletion(
|
return await chat.createCompletion(
|
||||||
model,
|
model,
|
||||||
messages,
|
messages,
|
||||||
|
search_type,
|
||||||
token,
|
token,
|
||||||
convId
|
convId
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user