chore: remove nested ternaries

This commit is contained in:
Joe Fleming
2026-03-13 19:13:50 -06:00
parent 2d99d17d60
commit 398b98393a
3 changed files with 11 additions and 13 deletions

View File

@@ -5,7 +5,8 @@
"correctness": "warn"
},
"rules": {
"eslint/no-unused-vars": "error"
"eslint/no-unused-vars": "error",
"unicorn/no-nested-ternary": "error"
},
"options": {
"typeAware": true,

View File

@@ -364,13 +364,13 @@ export class AgentLoop {
if (response.content) await onProgress(response.content);
const hint = response.toolCalls
.map((tc) => {
let display = ''
const firstVal = Object.values(tc.arguments)[0];
const display =
typeof firstVal === 'string'
? firstVal.length > 40
? `"${firstVal.slice(0, 40)}…"`
: `"${firstVal}"`
: '';
if (typeof firstVal === 'string') {
display = `"${firstVal.slice(0, 40) + (firstVal.length > 40 ? '…' : '')}"`
}
return `${tc.name}(${display})`;
})
.join(', ');

View File

@@ -146,17 +146,14 @@ export class LLMProvider {
: undefined;
try {
let toolChoice: 'required' | 'none' | 'auto' = 'auto'
if (opts.toolChoice === 'required' || opts.toolChoice === 'none') toolChoice = opts.toolChoice
const result = await generateText({
model,
messages: opts.messages as ModelMessage[],
// biome-ignore lint/suspicious/noExplicitAny: AI SDK tools type is complex
tools: aiTools as any,
toolChoice:
opts.toolChoice === 'required'
? 'required'
: opts.toolChoice === 'none'
? 'none'
: 'auto',
toolChoice,
maxOutputTokens: maxTokens,
temperature,
stopWhen: stepCountIs(1),