chore: remove nested ternaries
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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(', ');
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user