mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 23:29:02 +02:00
fix(deps): broken types after major update
This commit is contained in:
parent
dfcaebc613
commit
df6bb7e6bf
@ -5,6 +5,7 @@ import { getOpenAIOptions } from './providers.js';
|
||||
import OpenAI from 'openai';
|
||||
import { PROVIDER_PROMPTS } from '../constants/llm_prompt_constants.js';
|
||||
import log from '../../log.js';
|
||||
import { ChatCompletionMessageFunctionToolCall } from 'openai/resources/index.mjs';
|
||||
|
||||
export class OpenAIService extends BaseAIService {
|
||||
private openai: OpenAI | null = null;
|
||||
@ -101,7 +102,7 @@ export class OpenAIService extends BaseAIService {
|
||||
log.info('OpenAI API Stream Started');
|
||||
|
||||
// Create a closure to hold accumulated tool calls
|
||||
const accumulatedToolCalls: OpenAI.Chat.ChatCompletionMessageToolCall[] = [];
|
||||
const accumulatedToolCalls: OpenAI.Chat.ChatCompletionMessageFunctionToolCall[] = [];
|
||||
|
||||
// Return a response with the stream handler
|
||||
const response: ChatResponse = {
|
||||
@ -201,7 +202,7 @@ export class OpenAIService extends BaseAIService {
|
||||
completeText = content;
|
||||
|
||||
// Check if there are tool calls in the non-stream response
|
||||
const toolCalls = stream.choices[0]?.message?.tool_calls;
|
||||
const toolCalls = stream.choices[0]?.message?.tool_calls as ChatCompletionMessageFunctionToolCall[];
|
||||
if (toolCalls) {
|
||||
response.tool_calls = toolCalls;
|
||||
console.log('OpenAI API Tool Calls in Non-iterable Response:', JSON.stringify(toolCalls, null, 2));
|
||||
@ -251,7 +252,7 @@ export class OpenAIService extends BaseAIService {
|
||||
completionTokens: completion.usage?.completion_tokens,
|
||||
totalTokens: completion.usage?.total_tokens
|
||||
},
|
||||
tool_calls: completion.choices[0].message.tool_calls
|
||||
tool_calls: completion.choices[0].message.tool_calls as ChatCompletionMessageFunctionToolCall[]
|
||||
};
|
||||
}
|
||||
} catch (error) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user