dsh-code 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +21 -13
- package/README.md +21 -13
- package/lib/index.mjs +1156 -720
- package/lib/types/app.d.ts +2 -0
- package/lib/types/editor-keys.d.ts +105 -0
- package/lib/types/git-workflow.d.ts +6 -2
- package/lib/types/model-capabilities.d.ts +82 -0
- package/lib/types/provider-settings.d.ts +7 -0
- package/lib/types/render/lines.d.ts +25 -0
- package/lib/types/render/markdown.d.ts +1 -1
- package/lib/types/render/projection.d.ts +15 -1
- package/lib/types/render/text.d.ts +15 -9
- package/lib/types/render/width.d.ts +29 -0
- package/lib/types/session-directory.d.ts +27 -0
- package/lib/types/settings-file.d.ts +33 -0
- package/lib/types/store.d.ts +10 -0
- package/lib/types/subagents.d.ts +13 -3
- package/package.json +159 -159
- package/src/app.ts +1104 -1041
- package/src/editor-keys.ts +371 -0
- package/src/git-workflow.ts +10 -6
- package/src/index.ts +1637 -1523
- package/src/model-capabilities.ts +318 -0
- package/src/provider-settings.ts +16 -0
- package/src/render/lines.ts +403 -356
- package/src/render/markdown.ts +4 -7
- package/src/render/projection.ts +63 -40
- package/src/render/text.ts +152 -150
- package/src/render/width.ts +189 -0
- package/src/session-directory.ts +56 -0
- package/src/settings-file.ts +56 -0
- package/src/store.ts +26 -7
- package/src/subagents.ts +39 -6
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Same-id reasoning-capability inheritance for hand-declared pi-ai routes:
|
|
3
|
+
* the model catalog inherits capabilities by route key, not by model id, so a
|
|
4
|
+
* relay route listing `gpt-5.5` reads nothing from the installed `openai`
|
|
5
|
+
* catalog entry and materializes as `reasoning: false` until its settings
|
|
6
|
+
* entry declares `reasoningEfforts`. This adapter closes that gap without
|
|
7
|
+
* touching upstream: whenever a pi-ai profile's model entry carries no
|
|
8
|
+
* declaration and its live row advertises no efforts, but the same model id
|
|
9
|
+
* is declared (in a sibling settings entry) or advertised (on another route)
|
|
10
|
+
* elsewhere, the declaration is materialized into settings — verbatim from a
|
|
11
|
+
* sibling declaration when one exists, otherwise as an identity level map
|
|
12
|
+
* (`off` maps to null, every other level to its own name), which is the
|
|
13
|
+
* correct wire spelling for OpenAI-compatible relays. Writes ride the same
|
|
14
|
+
* `settings.mutate` path as the provider panel, so the upstream
|
|
15
|
+
* `assertServiceable` gate still rejects anything invalid atomically.
|
|
16
|
+
*
|
|
17
|
+
* @module @deepseek-ai/dsh-tui/model-capabilities
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import type { Context } from '@deepseek-ai/cordis'
|
|
21
|
+
import { loadModelDirectory, type ModelRow } from './models.ts'
|
|
22
|
+
|
|
23
|
+
/** The settings namespace the llm-pi-ai plugin owns (identity via `settingsNamespace`). */
|
|
24
|
+
const PI_AI_SETTINGS_NS = 'llm-pi-ai'
|
|
25
|
+
|
|
26
|
+
/** The effort level that means "send no reasoning parameter"; its wire value is always null. */
|
|
27
|
+
const OFF_LEVEL = 'off'
|
|
28
|
+
|
|
29
|
+
/* ------------------------------------------------------------------ *
|
|
30
|
+
* Structural service faces (same discipline as provider-settings: the
|
|
31
|
+
* settings package is never imported, only described structurally).
|
|
32
|
+
* ------------------------------------------------------------------ */
|
|
33
|
+
|
|
34
|
+
/** One configurable-provider directory entry (subset of the `llm` service face). */
|
|
35
|
+
interface ConfigurableEntryFace {
|
|
36
|
+
readonly provider: string
|
|
37
|
+
readonly settingsNs: string
|
|
38
|
+
readonly settingsPath: readonly string[]
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** One redacted settings descriptor (subset of `SettingsDescriptor`). */
|
|
42
|
+
interface DescriptorFace {
|
|
43
|
+
readonly ns: string
|
|
44
|
+
readonly value: unknown
|
|
45
|
+
readonly revision: number
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** One path-addressed edit to a stored section (subset of `SettingsPathOp`). */
|
|
49
|
+
interface PathOpFace {
|
|
50
|
+
readonly op: 'set' | 'unset'
|
|
51
|
+
readonly path: readonly string[]
|
|
52
|
+
readonly value?: unknown
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** The subset of the `settings` service this module reads and writes. */
|
|
56
|
+
interface SettingsFace {
|
|
57
|
+
describe(options?: { readonly redactSecrets?: boolean }): readonly DescriptorFace[]
|
|
58
|
+
mutate(ns: string, ops: readonly PathOpFace[], expectedRevision?: number): Promise<void>
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** A notice sink structurally compatible with the app bridge's `notify`. */
|
|
62
|
+
export type CapabilityNotice = (text: string, tone?: 'info' | 'warning' | 'error') => void
|
|
63
|
+
|
|
64
|
+
/** Single-line a misbehaving error for the notice channel. */
|
|
65
|
+
function singleLine(message: string): string {
|
|
66
|
+
const spaced = [...message].map(ch => { const code = ch.charCodeAt(0); return code < 32 || code === 127 ? ' ' : ch }).join('')
|
|
67
|
+
return spaced.split(' ').filter(part => part !== '').join(' ')
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** Human text for a rejection value. */
|
|
71
|
+
function messageOf(error: unknown): string {
|
|
72
|
+
return error instanceof Error ? error.message : String(error)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Read the value at a path through plain objects; undefined when any segment misses. */
|
|
76
|
+
function getPath(value: unknown, path: readonly string[]): unknown {
|
|
77
|
+
let current = value
|
|
78
|
+
for (const segment of path) {
|
|
79
|
+
if (typeof current !== 'object' || current === null) return undefined
|
|
80
|
+
current = (current as Record<string, unknown>)[segment]
|
|
81
|
+
}
|
|
82
|
+
return current
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** Whether a raw settings value is a usable `reasoningEfforts` dict (non-empty, non-false). */
|
|
86
|
+
function isDeclaredEfforts(value: unknown): value is Record<string, unknown> {
|
|
87
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value) && Object.keys(value).length > 0
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* The identity level map for an advertised effort list: `off` sends no
|
|
92
|
+
* parameter, every other level keeps its own name — the wire spelling
|
|
93
|
+
* OpenAI-compatible relays accept as-is.
|
|
94
|
+
*/
|
|
95
|
+
function identityEfforts(levels: readonly string[]): Record<string, string | null> {
|
|
96
|
+
const dict: Record<string, string | null> = {}
|
|
97
|
+
for (const level of levels) dict[level] = level === OFF_LEVEL ? null : level
|
|
98
|
+
return dict
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/* ------------------------------------------------------------------ *
|
|
102
|
+
* Pure planning.
|
|
103
|
+
* ------------------------------------------------------------------ */
|
|
104
|
+
|
|
105
|
+
/** One pi-ai provider profile as stored in settings, addressed for mutation. */
|
|
106
|
+
export interface CapabilityProfileSource {
|
|
107
|
+
/** Settings namespace owning the profile (`llm-pi-ai`). */
|
|
108
|
+
readonly settingsNs: string
|
|
109
|
+
/** Path from the section root to this provider's profile. */
|
|
110
|
+
readonly settingsPath: readonly string[]
|
|
111
|
+
/** Revision of the owning section at read time. */
|
|
112
|
+
readonly revision: number
|
|
113
|
+
/** Raw model entries, exactly as stored (declaration fields included). */
|
|
114
|
+
readonly models: readonly Record<string, unknown>[]
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** One planned per-provider models rewrite. */
|
|
118
|
+
export interface CapabilitySyncPlan {
|
|
119
|
+
/** Provider route the plan targets. */
|
|
120
|
+
readonly provider: string
|
|
121
|
+
/** Settings namespace owning the profile. */
|
|
122
|
+
readonly settingsNs: string
|
|
123
|
+
/** Path from the section root to the provider profile. */
|
|
124
|
+
readonly settingsPath: readonly string[]
|
|
125
|
+
/** Raw model entries, exactly as stored (declaration fields included). */
|
|
126
|
+
readonly models: readonly Record<string, unknown>[]
|
|
127
|
+
/** Fingerprint of the source models array this plan was derived from. */
|
|
128
|
+
readonly sourceFingerprint: string
|
|
129
|
+
/** Document revision of the owning section when the plan was derived. */
|
|
130
|
+
readonly sourceRevision: number
|
|
131
|
+
/** Model ids that gained a declaration, notice-facing. */
|
|
132
|
+
readonly inherited: readonly string[]
|
|
133
|
+
/** `provider/model` labels the declarations came from, notice-facing. */
|
|
134
|
+
readonly sources: readonly string[]
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Plan the reasoning declarations to materialize. A model entry inherits
|
|
139
|
+
* when it declares nothing (`reasoningEfforts` absent — a dict or `false` is
|
|
140
|
+
* an explicit choice and is never touched) and its live row advertises no
|
|
141
|
+
* efforts; the donor is the first sibling settings declaration for the same
|
|
142
|
+
* id, copied verbatim so dialect wire spellings survive, otherwise the first
|
|
143
|
+
* other-route row advertising efforts for that id, mapped by identity.
|
|
144
|
+
* Entries never lose fields and keep their key order; a provider appears in
|
|
145
|
+
* the result only when at least one entry changes.
|
|
146
|
+
* @param input - the live model rows and the raw pi-ai profiles from settings.
|
|
147
|
+
* @returns one plan per provider with at least one inheritance.
|
|
148
|
+
*/
|
|
149
|
+
export function planCapabilitySync(input: {
|
|
150
|
+
readonly rows: readonly ModelRow[]
|
|
151
|
+
readonly profiles: ReadonlyMap<string, CapabilityProfileSource>
|
|
152
|
+
}): readonly CapabilitySyncPlan[] {
|
|
153
|
+
// Sibling declarations, first profile order wins: { id -> { dict, provider } }.
|
|
154
|
+
const declared = new Map<string, { dict: Record<string, unknown>; provider: string }>()
|
|
155
|
+
for (const [provider, profile] of input.profiles) {
|
|
156
|
+
for (const entry of profile.models) {
|
|
157
|
+
const efforts = entry.reasoningEfforts
|
|
158
|
+
if (!isDeclaredEfforts(efforts)) continue
|
|
159
|
+
if (!declared.has(String(entry.id))) declared.set(String(entry.id), { dict: efforts, provider })
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
// Advertised donors, first row order wins: { id -> { levels, provider } }.
|
|
163
|
+
// A row whose only level is `off` advertises nothing usable and is skipped.
|
|
164
|
+
const advertised = new Map<string, { levels: readonly string[]; provider: string }>()
|
|
165
|
+
for (const row of input.rows) {
|
|
166
|
+
const levels = row.reasoning?.efforts.map(effort => effort.id) ?? []
|
|
167
|
+
if (levels.filter(level => level !== OFF_LEVEL).length === 0) continue
|
|
168
|
+
if (!advertised.has(row.model)) advertised.set(row.model, { levels, provider: row.provider })
|
|
169
|
+
}
|
|
170
|
+
const plans: CapabilitySyncPlan[] = []
|
|
171
|
+
for (const [provider, profile] of input.profiles) {
|
|
172
|
+
const inherited: string[] = []
|
|
173
|
+
const sources: string[] = []
|
|
174
|
+
const models = profile.models.map((entry): Record<string, unknown> => {
|
|
175
|
+
if (entry.reasoningEfforts !== undefined) return entry
|
|
176
|
+
const id = String(entry.id)
|
|
177
|
+
const sibling = declared.get(id)
|
|
178
|
+
if (sibling !== undefined && sibling.provider !== provider) {
|
|
179
|
+
inherited.push(id)
|
|
180
|
+
if (!sources.includes(`${sibling.provider}/${id}`)) sources.push(`${sibling.provider}/${id}`)
|
|
181
|
+
return { ...entry, reasoningEfforts: sibling.dict }
|
|
182
|
+
}
|
|
183
|
+
const donor = advertised.get(id)
|
|
184
|
+
if (donor !== undefined && donor.provider !== provider) {
|
|
185
|
+
inherited.push(id)
|
|
186
|
+
if (!sources.includes(`${donor.provider}/${id}`)) sources.push(`${donor.provider}/${id}`)
|
|
187
|
+
return { ...entry, reasoningEfforts: identityEfforts(donor.levels) }
|
|
188
|
+
}
|
|
189
|
+
return entry
|
|
190
|
+
})
|
|
191
|
+
if (inherited.length > 0) {
|
|
192
|
+
plans.push({
|
|
193
|
+
provider,
|
|
194
|
+
settingsNs: profile.settingsNs,
|
|
195
|
+
settingsPath: profile.settingsPath,
|
|
196
|
+
models,
|
|
197
|
+
sourceFingerprint: JSON.stringify(profile.models),
|
|
198
|
+
sourceRevision: profile.revision,
|
|
199
|
+
inherited,
|
|
200
|
+
sources,
|
|
201
|
+
})
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return plans
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/* ------------------------------------------------------------------ *
|
|
208
|
+
* Application.
|
|
209
|
+
* ------------------------------------------------------------------ */
|
|
210
|
+
|
|
211
|
+
/** Provider -> the source snapshot and document revision its last write landed against. */
|
|
212
|
+
const lastApplied = new Map<string, { fingerprint: string; revision: number }>()
|
|
213
|
+
|
|
214
|
+
/** Fresh revision of one namespace, or undefined when it does not resolve. */
|
|
215
|
+
function revisionOf(settings: SettingsFace, ns: string): number | undefined {
|
|
216
|
+
try {
|
|
217
|
+
for (const descriptor of settings.describe({ redactSecrets: true })) {
|
|
218
|
+
if (descriptor.ns === ns) return descriptor.revision
|
|
219
|
+
}
|
|
220
|
+
} catch {
|
|
221
|
+
return undefined
|
|
222
|
+
}
|
|
223
|
+
return undefined
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Materialize same-id reasoning declarations once per provider. Reads the
|
|
228
|
+
* configurable directory, the redacted settings document, and the live model
|
|
229
|
+
* rows; plans; then writes each provider's merged models array through
|
|
230
|
+
* `settings.mutate` under a fresh revision (writes bump the section
|
|
231
|
+
* revision, so per-plan revisions are re-read). Every failure converges to a
|
|
232
|
+
* single-line notice — the caller's promise never rejects and the session
|
|
233
|
+
* keeps running on the previous configuration.
|
|
234
|
+
* @param ctx - context carrying the `llm` and `settings` services (optional).
|
|
235
|
+
* @param notify - the app bridge's notice sink, when one is live.
|
|
236
|
+
*/
|
|
237
|
+
export async function syncModelCapabilities(ctx: Context, notify?: CapabilityNotice): Promise<void> {
|
|
238
|
+
try {
|
|
239
|
+
const llm = ctx.get('llm') as { listConfigurableProviders?: () => readonly ConfigurableEntryFace[] } | undefined
|
|
240
|
+
if (llm?.listConfigurableProviders === undefined) return
|
|
241
|
+
const settings = ctx.get('settings') as SettingsFace | undefined
|
|
242
|
+
if (settings === undefined) return
|
|
243
|
+
let entries: readonly ConfigurableEntryFace[]
|
|
244
|
+
try {
|
|
245
|
+
entries = llm.listConfigurableProviders()
|
|
246
|
+
} catch {
|
|
247
|
+
return
|
|
248
|
+
}
|
|
249
|
+
const routed = entries.filter(entry => entry.settingsNs === PI_AI_SETTINGS_NS)
|
|
250
|
+
if (routed.length === 0) return
|
|
251
|
+
let descriptors: readonly DescriptorFace[]
|
|
252
|
+
try {
|
|
253
|
+
descriptors = settings.describe({ redactSecrets: true })
|
|
254
|
+
} catch {
|
|
255
|
+
return
|
|
256
|
+
}
|
|
257
|
+
const namespaces = new Map(descriptors.map(descriptor => [descriptor.ns, descriptor] as const))
|
|
258
|
+
const profiles = new Map<string, CapabilityProfileSource>()
|
|
259
|
+
for (const entry of routed) {
|
|
260
|
+
const namespace = namespaces.get(entry.settingsNs)
|
|
261
|
+
if (namespace === undefined) continue
|
|
262
|
+
const profile = entry.settingsPath.length === 0
|
|
263
|
+
? namespace.value
|
|
264
|
+
: getPath(namespace.value, entry.settingsPath)
|
|
265
|
+
const models = Array.isArray((profile as { models?: unknown } | null)?.models)
|
|
266
|
+
? (profile as { models: unknown }).models as readonly Record<string, unknown>[]
|
|
267
|
+
: undefined
|
|
268
|
+
// An absent models list is a dormant or unconfigured route: nothing to
|
|
269
|
+
// inherit into (and the empty allow-list there is deliberate upstream).
|
|
270
|
+
if (models === undefined) continue
|
|
271
|
+
profiles.set(entry.provider, {
|
|
272
|
+
settingsNs: entry.settingsNs,
|
|
273
|
+
settingsPath: entry.settingsPath,
|
|
274
|
+
revision: namespace.revision,
|
|
275
|
+
models,
|
|
276
|
+
})
|
|
277
|
+
}
|
|
278
|
+
if (profiles.size === 0) return
|
|
279
|
+
const directory = await loadModelDirectory(ctx)
|
|
280
|
+
for (const plan of planCapabilitySync({ rows: directory.rows, profiles })) {
|
|
281
|
+
// Skip only a provable echo of our own write: the same source
|
|
282
|
+
// snapshot at the same document revision we already wrote against
|
|
283
|
+
// (our write re-triggers the document event before the re-read
|
|
284
|
+
// catches up). An external edit that removes a materialized
|
|
285
|
+
// declaration bumps the revision, so identical source content
|
|
286
|
+
// re-plans and re-writes instead of being skipped forever.
|
|
287
|
+
const applied = lastApplied.get(plan.provider)
|
|
288
|
+
if (applied !== undefined && applied.fingerprint === plan.sourceFingerprint && applied.revision === plan.sourceRevision) continue
|
|
289
|
+
// Writes bump the section revision; re-read per plan so the second
|
|
290
|
+
// provider's optimistic revision is not already stale.
|
|
291
|
+
const revision = revisionOf(settings, plan.settingsNs)
|
|
292
|
+
if (revision === undefined) continue
|
|
293
|
+
try {
|
|
294
|
+
await settings.mutate(
|
|
295
|
+
plan.settingsNs,
|
|
296
|
+
[{ op: 'set', path: [...plan.settingsPath, 'models'], value: plan.models }],
|
|
297
|
+
revision,
|
|
298
|
+
)
|
|
299
|
+
lastApplied.set(plan.provider, { fingerprint: plan.sourceFingerprint, revision: plan.sourceRevision })
|
|
300
|
+
const shown = plan.sources.slice(0, 3).join(', ')
|
|
301
|
+
const more = plan.sources.length > 3 ? `, +${plan.sources.length - 3}` : ''
|
|
302
|
+
notify?.(
|
|
303
|
+
`inherited reasoning levels for ${plan.inherited.length} model${plan.inherited.length === 1 ? '' : 's'} on ${plan.provider} (from ${shown}${more})`,
|
|
304
|
+
'info',
|
|
305
|
+
)
|
|
306
|
+
} catch (error) {
|
|
307
|
+
notify?.(`capability inheritance failed on ${plan.provider}: ${singleLine(messageOf(error))}`, 'warning')
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
} catch {
|
|
311
|
+
// A background sync must never surface as an unhandled rejection.
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/** Test seam: forget the applied-write fingerprints. */
|
|
316
|
+
export function resetCapabilitySyncState(): void {
|
|
317
|
+
lastApplied.clear()
|
|
318
|
+
}
|
package/src/provider-settings.ts
CHANGED
|
@@ -138,11 +138,16 @@ function configurationOf(profile: unknown): ProviderConfiguration {
|
|
|
138
138
|
if (typeof value !== 'object' || value === null) return []
|
|
139
139
|
const entry = value as Record<string, unknown>
|
|
140
140
|
if (typeof entry.id !== 'string' || entry.id.trim() === '') return []
|
|
141
|
+
// Fields the editor does not understand ride along untouched: dropping
|
|
142
|
+
// them here would let the next save strip hand-written reasoningEfforts
|
|
143
|
+
// or compat declarations out of the stored profile.
|
|
144
|
+
const { id: _id, name: _name, contextWindow: _contextWindow, maxTokens: _maxTokens, ...extras } = entry
|
|
141
145
|
return [{
|
|
142
146
|
id: entry.id,
|
|
143
147
|
...(typeof entry.name === 'string' && entry.name.trim() !== '' ? { name: entry.name } : {}),
|
|
144
148
|
...(typeof entry.contextWindow === 'number' && Number.isFinite(entry.contextWindow) ? { contextWindow: entry.contextWindow } : {}),
|
|
145
149
|
...(typeof entry.maxTokens === 'number' && Number.isFinite(entry.maxTokens) ? { maxTokens: entry.maxTokens } : {}),
|
|
150
|
+
...Object.keys(extras).length > 0 ? { extras } : {},
|
|
146
151
|
}]
|
|
147
152
|
})
|
|
148
153
|
return {
|
|
@@ -194,6 +199,13 @@ export interface ProviderModelSettings {
|
|
|
194
199
|
readonly name?: string
|
|
195
200
|
readonly contextWindow?: number
|
|
196
201
|
readonly maxTokens?: number
|
|
202
|
+
/**
|
|
203
|
+
* Remaining entry fields the editor does not model (`reasoningEfforts`,
|
|
204
|
+
* `compat`, `input`, …), carried verbatim so a save preserves them.
|
|
205
|
+
* Populated by {@link loadProviderSettings}; never contains the four
|
|
206
|
+
* modelled keys.
|
|
207
|
+
*/
|
|
208
|
+
readonly extras?: Readonly<Record<string, unknown>>
|
|
197
209
|
}
|
|
198
210
|
|
|
199
211
|
/** The small, portable subset of a provider profile the terminal edits. */
|
|
@@ -514,6 +526,10 @@ export async function saveProviderConfiguration(
|
|
|
514
526
|
}
|
|
515
527
|
return {
|
|
516
528
|
id,
|
|
529
|
+
// Editor-invisible fields ride along after the id; the modelled keys
|
|
530
|
+
// spread last so a panel edit (or clear) always wins over a carried
|
|
531
|
+
// value. extras never contains those keys — see configurationOf.
|
|
532
|
+
...model.extras,
|
|
517
533
|
...(model.name === undefined || model.name.trim() === '' ? {} : { name: model.name.trim() }),
|
|
518
534
|
...(model.contextWindow === undefined ? {} : { contextWindow: model.contextWindow }),
|
|
519
535
|
...(model.maxTokens === undefined ? {} : { maxTokens: model.maxTokens }),
|