v4.6.5 (#620)
This commit is contained in:
@@ -40,7 +40,7 @@ export async function dispatchContentExtract(props: Props): Promise<Response> {
|
||||
const extractModel = global.extractModels[0];
|
||||
const chatHistories = getHistories(history, histories);
|
||||
|
||||
const { arg, tokens } = await (async () => {
|
||||
const { arg, tokens, rawResponse } = await (async () => {
|
||||
if (extractModel.functionCall) {
|
||||
return functionCall({
|
||||
...props,
|
||||
@@ -176,6 +176,7 @@ ${content}
|
||||
|
||||
const tokens = response.usage?.total_tokens || 0;
|
||||
return {
|
||||
rawResponse: response?.choices?.[0]?.message?.tool_calls?.[0]?.function?.arguments || '',
|
||||
tokens,
|
||||
arg
|
||||
};
|
||||
@@ -195,7 +196,7 @@ async function completions({
|
||||
json: extractKeys
|
||||
.map(
|
||||
(item) =>
|
||||
`{"key":"${item.key}", "description":"${item.required}", "required":${item.required}${
|
||||
`{"key":"${item.key}", "description":"${item.desc}", "required":${item.required}${
|
||||
item.enum ? `, "enum":"[${item.enum.split('\n')}]"` : ''
|
||||
}}`
|
||||
)
|
||||
@@ -223,6 +224,7 @@ Human: ${content}`
|
||||
|
||||
if (start === -1 || end === -1)
|
||||
return {
|
||||
rawResponse: answer,
|
||||
tokens: totalTokens,
|
||||
arg: {}
|
||||
};
|
||||
@@ -234,11 +236,13 @@ Human: ${content}`
|
||||
|
||||
try {
|
||||
return {
|
||||
rawResponse: answer,
|
||||
tokens: totalTokens,
|
||||
arg: JSON.parse(jsonStr) as Record<string, any>
|
||||
};
|
||||
} catch (error) {
|
||||
return {
|
||||
rawResponse: answer,
|
||||
tokens: totalTokens,
|
||||
arg: {}
|
||||
};
|
||||
|
||||
@@ -50,6 +50,7 @@ export async function dispatchModules({
|
||||
appId,
|
||||
modules,
|
||||
chatId,
|
||||
responseChatItemId,
|
||||
histories = [],
|
||||
startParams = {},
|
||||
variables = {},
|
||||
@@ -63,6 +64,7 @@ export async function dispatchModules({
|
||||
appId: string;
|
||||
modules: ModuleItemType[];
|
||||
chatId?: string;
|
||||
responseChatItemId?: string;
|
||||
histories: ChatItemType[];
|
||||
startParams?: Record<string, any>;
|
||||
variables?: Record<string, any>;
|
||||
@@ -201,6 +203,7 @@ export async function dispatchModules({
|
||||
user,
|
||||
appId,
|
||||
chatId,
|
||||
responseChatItemId,
|
||||
stream,
|
||||
detail,
|
||||
variables,
|
||||
|
||||
@@ -21,6 +21,7 @@ export const dispatchHttpRequest = async (props: HttpRequestProps): Promise<Http
|
||||
let {
|
||||
appId,
|
||||
chatId,
|
||||
responseChatItemId,
|
||||
variables,
|
||||
inputs: {
|
||||
system_httpMethod: httpMethod,
|
||||
@@ -57,6 +58,7 @@ export const dispatchHttpRequest = async (props: HttpRequestProps): Promise<Http
|
||||
requestBody: {
|
||||
appId,
|
||||
chatId,
|
||||
responseChatItemId,
|
||||
variables,
|
||||
data: body
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user