chore: fix type errors

This commit is contained in:
Elian Doran
2026-03-30 20:23:00 +03:00
parent 41164add15
commit 841c58ca8c
5 changed files with 10 additions and 11 deletions

View File

@@ -98,7 +98,7 @@ export async function streamChatCompletion(
callbacks.onDone();
break;
}
} catch {
} catch (e) {
console.error("Failed to parse SSE data line:", line, e);
}
}

View File

@@ -223,8 +223,7 @@ export default function SidebarChat() {
<>
<ActionButton
icon="bx bx-plus"
text=""
title={t("sidebar_chat.new_chat")}
text={t("sidebar_chat.new_chat")}
onClick={handleNewChat}
/>
<Dropdown
@@ -264,8 +263,7 @@ export default function SidebarChat() {
</Dropdown>
<ActionButton
icon="bx bx-save"
text=""
title={t("sidebar_chat.save_chat")}
text={t("sidebar_chat.save_chat")}
onClick={handleSaveChat}
disabled={chat.messages.length === 0}
/>

View File

@@ -1,5 +1,5 @@
import { createAnthropic, type AnthropicProvider as AnthropicSDKProvider } from "@ai-sdk/anthropic";
import { generateText, streamText, stepCountIs, type CoreMessage } from "ai";
import { generateText, streamText, stepCountIs, type CoreMessage, type ToolSet } from "ai";
import type { LlmMessage } from "@triliumnext/commons";
import becca from "../../../becca/becca.js";
@@ -191,7 +191,7 @@ export class AnthropicProvider implements LlmProvider {
}
// Build tools object
const tools: Record<string, unknown> = {};
const tools: ToolSet = {};
if (config.enableWebSearch) {
tools.web_search = this.anthropic.tools.webSearch_20250305({
@@ -211,8 +211,6 @@ export class AnthropicProvider implements LlmProvider {
if (Object.keys(tools).length > 0) {
streamOptions.tools = tools;
// Allow multiple tool use cycles before final response
streamOptions.maxSteps = 5;
// Override default stopWhen which stops after 1 step
streamOptions.stopWhen = stepCountIs(5);
// Let model decide when to use tools vs respond with text
streamOptions.toolChoice = "auto";
@@ -232,7 +230,7 @@ export class AnthropicProvider implements LlmProvider {
async generateTitle(firstMessage: string): Promise<string> {
const { text } = await generateText({
model: this.anthropic(TITLE_MODEL),
maxTokens: TITLE_MAX_TOKENS,
maxOutputTokens: TITLE_MAX_TOKENS,
messages: [
{
role: "user",

View File

@@ -46,6 +46,8 @@ export interface ModelInfo {
costMultiplier?: number;
/** Maximum context window size in tokens */
contextWindow?: number;
/** Whether this is a legacy/older model */
isLegacy?: boolean;
}
export interface LlmProvider {

View File

@@ -44,7 +44,8 @@ export interface HiddenSubtreeItem {
| "quickSearch"
| "commandPalette"
| "toggleZenMode"
| "mobileTabSwitcher";
| "mobileTabSwitcher"
| "sidebarChat";
command?: keyof typeof Command;
/**
* If set to true, then branches will be enforced to be in the correct place.