mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-18 14:25:51 +00:00
更新大量 tsx 原始文件; 已经迁移 login panel; 部分 (#121)
* style(B1-1): 格式化 ink/buddy/cli/context/screens/tasks/services/keybindings/state (43 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 修复了 Box.tsx 和 ScrollBox.tsx 中无效的 global.d.ts import。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-2): 格式化 commands (79 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-3): 格式化 components/messages,permissions,mcp,sandbox,shell (104 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-4): 格式化 components/PromptInput,FeedbackSurvey,tasks,agents,skills,design-system,wizard (73 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-5): 格式化 components其余 + hooks + tools (232 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style(B1-6): 格式化 main/entrypoints/utils/moreright (21 files) 纯格式化:移除分号、React Compiler import、import 多行展开。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: 更新 README,新增 Run.ps1/TODO.md,删除 V6.md - README.md: 大幅重写,更详细版本历史和配置示例 - Run.ps1: 新增 Windows 启动脚本 - TODO.md: 新增包完成清单 - V6.md: 删除(架构重构规划已不适用) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: 修复以前的问题 * fix: 修复 login 面板的问题 --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,296 +1,337 @@
|
||||
import { c as _c } from "react/compiler-runtime";
|
||||
import chalk from 'chalk';
|
||||
import * as React from 'react';
|
||||
import type { CommandResultDisplay } from '../../commands.js';
|
||||
import { ModelPicker } from '../../components/ModelPicker.js';
|
||||
import { COMMON_HELP_ARGS, COMMON_INFO_ARGS } from '../../constants/xml.js';
|
||||
import { type AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS, logEvent } from '../../services/analytics/index.js';
|
||||
import { useAppState, useSetAppState } from '../../state/AppState.js';
|
||||
import type { LocalJSXCommandCall } from '../../types/command.js';
|
||||
import type { EffortLevel } from '../../utils/effort.js';
|
||||
import { isBilledAsExtraUsage } from '../../utils/extraUsage.js';
|
||||
import { clearFastModeCooldown, isFastModeAvailable, isFastModeEnabled, isFastModeSupportedByModel } from '../../utils/fastMode.js';
|
||||
import { MODEL_ALIASES } from '../../utils/model/aliases.js';
|
||||
import { checkOpus1mAccess, checkSonnet1mAccess } from '../../utils/model/check1mAccess.js';
|
||||
import { getDefaultMainLoopModelSetting, isOpus1mMergeEnabled, renderDefaultModelSetting } from '../../utils/model/model.js';
|
||||
import { isModelAllowed } from '../../utils/model/modelAllowlist.js';
|
||||
import { validateModel } from '../../utils/model/validateModel.js';
|
||||
function ModelPickerWrapper(t0) {
|
||||
const $ = _c(17);
|
||||
const {
|
||||
onDone
|
||||
} = t0;
|
||||
const mainLoopModel = useAppState(_temp);
|
||||
const mainLoopModelForSession = useAppState(_temp2);
|
||||
const isFastMode = useAppState(_temp3);
|
||||
const setAppState = useSetAppState();
|
||||
let t1;
|
||||
if ($[0] !== mainLoopModel || $[1] !== onDone) {
|
||||
t1 = function handleCancel() {
|
||||
logEvent("tengu_model_command_menu", {
|
||||
action: "cancel" as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS
|
||||
});
|
||||
const displayModel = renderModelLabel(mainLoopModel);
|
||||
onDone(`Kept model as ${chalk.bold(displayModel)}`, {
|
||||
display: "system"
|
||||
});
|
||||
};
|
||||
$[0] = mainLoopModel;
|
||||
$[1] = onDone;
|
||||
$[2] = t1;
|
||||
} else {
|
||||
t1 = $[2];
|
||||
import chalk from 'chalk'
|
||||
import * as React from 'react'
|
||||
import type { CommandResultDisplay } from '../../commands.js'
|
||||
import { ModelPicker } from '../../components/ModelPicker.js'
|
||||
import { COMMON_HELP_ARGS, COMMON_INFO_ARGS } from '../../constants/xml.js'
|
||||
import {
|
||||
type AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
|
||||
logEvent,
|
||||
} from '../../services/analytics/index.js'
|
||||
import { useAppState, useSetAppState } from '../../state/AppState.js'
|
||||
import type { LocalJSXCommandCall } from '../../types/command.js'
|
||||
import type { EffortLevel } from '../../utils/effort.js'
|
||||
import { isBilledAsExtraUsage } from '../../utils/extraUsage.js'
|
||||
import {
|
||||
clearFastModeCooldown,
|
||||
isFastModeAvailable,
|
||||
isFastModeEnabled,
|
||||
isFastModeSupportedByModel,
|
||||
} from '../../utils/fastMode.js'
|
||||
import { MODEL_ALIASES } from '../../utils/model/aliases.js'
|
||||
import {
|
||||
checkOpus1mAccess,
|
||||
checkSonnet1mAccess,
|
||||
} from '../../utils/model/check1mAccess.js'
|
||||
import {
|
||||
getDefaultMainLoopModelSetting,
|
||||
isOpus1mMergeEnabled,
|
||||
renderDefaultModelSetting,
|
||||
} from '../../utils/model/model.js'
|
||||
import { isModelAllowed } from '../../utils/model/modelAllowlist.js'
|
||||
import { validateModel } from '../../utils/model/validateModel.js'
|
||||
|
||||
function ModelPickerWrapper({
|
||||
onDone,
|
||||
}: {
|
||||
onDone: (
|
||||
result?: string,
|
||||
options?: { display?: CommandResultDisplay },
|
||||
) => void
|
||||
}): React.ReactNode {
|
||||
const mainLoopModel = useAppState(s => s.mainLoopModel)
|
||||
const mainLoopModelForSession = useAppState(s => s.mainLoopModelForSession)
|
||||
const isFastMode = useAppState(s => s.fastMode)
|
||||
const setAppState = useSetAppState()
|
||||
|
||||
function handleCancel(): void {
|
||||
logEvent('tengu_model_command_menu', {
|
||||
action:
|
||||
'cancel' as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
|
||||
})
|
||||
const displayModel = renderModelLabel(mainLoopModel)
|
||||
onDone(`Kept model as ${chalk.bold(displayModel)}`, {
|
||||
display: 'system',
|
||||
})
|
||||
}
|
||||
const handleCancel = t1;
|
||||
let t2;
|
||||
if ($[3] !== isFastMode || $[4] !== mainLoopModel || $[5] !== onDone || $[6] !== setAppState) {
|
||||
t2 = function handleSelect(model, effort) {
|
||||
logEvent("tengu_model_command_menu", {
|
||||
action: model as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
|
||||
from_model: mainLoopModel as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
|
||||
to_model: model as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS
|
||||
});
|
||||
setAppState(prev => ({
|
||||
...prev,
|
||||
mainLoopModel: model,
|
||||
mainLoopModelForSession: null
|
||||
}));
|
||||
let message = `Set model to ${chalk.bold(renderModelLabel(model))}`;
|
||||
if (effort !== undefined) {
|
||||
message = message + ` with ${chalk.bold(effort)} effort`;
|
||||
|
||||
function handleSelect(
|
||||
model: string | null,
|
||||
effort: EffortLevel | undefined,
|
||||
): void {
|
||||
logEvent('tengu_model_command_menu', {
|
||||
action:
|
||||
model as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
|
||||
from_model:
|
||||
mainLoopModel as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
|
||||
to_model:
|
||||
model as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
|
||||
})
|
||||
setAppState(prev => ({
|
||||
...prev,
|
||||
mainLoopModel: model,
|
||||
mainLoopModelForSession: null,
|
||||
}))
|
||||
|
||||
let message = `Set model to ${chalk.bold(renderModelLabel(model))}`
|
||||
if (effort !== undefined) {
|
||||
message += ` with ${chalk.bold(effort)} effort`
|
||||
}
|
||||
|
||||
// Turn off fast mode if switching to unsupported model
|
||||
let wasFastModeToggledOn = undefined
|
||||
if (isFastModeEnabled()) {
|
||||
clearFastModeCooldown()
|
||||
if (!isFastModeSupportedByModel(model) && isFastMode) {
|
||||
setAppState(prev => ({
|
||||
...prev,
|
||||
fastMode: false,
|
||||
}))
|
||||
wasFastModeToggledOn = false
|
||||
// Do not update fast mode in settings since this is an automatic downgrade
|
||||
} else if (
|
||||
isFastModeSupportedByModel(model) &&
|
||||
isFastModeAvailable() &&
|
||||
isFastMode
|
||||
) {
|
||||
message += ` · Fast mode ON`
|
||||
wasFastModeToggledOn = true
|
||||
}
|
||||
let wasFastModeToggledOn = undefined;
|
||||
if (isFastModeEnabled()) {
|
||||
clearFastModeCooldown();
|
||||
if (!isFastModeSupportedByModel(model) && isFastMode) {
|
||||
setAppState(_temp4);
|
||||
wasFastModeToggledOn = false;
|
||||
} else {
|
||||
if (isFastModeSupportedByModel(model) && isFastModeAvailable() && isFastMode) {
|
||||
message = message + " \xB7 Fast mode ON";
|
||||
wasFastModeToggledOn = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isBilledAsExtraUsage(model, wasFastModeToggledOn === true, isOpus1mMergeEnabled())) {
|
||||
message = message + " \xB7 Billed as extra usage";
|
||||
}
|
||||
if (wasFastModeToggledOn === false) {
|
||||
message = message + " \xB7 Fast mode OFF";
|
||||
}
|
||||
onDone(message);
|
||||
};
|
||||
$[3] = isFastMode;
|
||||
$[4] = mainLoopModel;
|
||||
$[5] = onDone;
|
||||
$[6] = setAppState;
|
||||
$[7] = t2;
|
||||
} else {
|
||||
t2 = $[7];
|
||||
}
|
||||
|
||||
if (
|
||||
isBilledAsExtraUsage(
|
||||
model,
|
||||
wasFastModeToggledOn === true,
|
||||
isOpus1mMergeEnabled(),
|
||||
)
|
||||
) {
|
||||
message += ` · Billed as extra usage`
|
||||
}
|
||||
|
||||
if (wasFastModeToggledOn === false) {
|
||||
// Fast mode was toggled off, show suffix after extra usage billing
|
||||
message += ` · Fast mode OFF`
|
||||
}
|
||||
|
||||
onDone(message)
|
||||
}
|
||||
const handleSelect = t2;
|
||||
let t3;
|
||||
if ($[8] !== isFastMode || $[9] !== mainLoopModel) {
|
||||
t3 = isFastModeEnabled() && isFastMode && isFastModeSupportedByModel(mainLoopModel) && isFastModeAvailable();
|
||||
$[8] = isFastMode;
|
||||
$[9] = mainLoopModel;
|
||||
$[10] = t3;
|
||||
} else {
|
||||
t3 = $[10];
|
||||
}
|
||||
let t4;
|
||||
if ($[11] !== handleCancel || $[12] !== handleSelect || $[13] !== mainLoopModel || $[14] !== mainLoopModelForSession || $[15] !== t3) {
|
||||
t4 = <ModelPicker initial={mainLoopModel} sessionModel={mainLoopModelForSession} onSelect={handleSelect} onCancel={handleCancel} isStandaloneCommand={true} showFastModeNotice={t3} />;
|
||||
$[11] = handleCancel;
|
||||
$[12] = handleSelect;
|
||||
$[13] = mainLoopModel;
|
||||
$[14] = mainLoopModelForSession;
|
||||
$[15] = t3;
|
||||
$[16] = t4;
|
||||
} else {
|
||||
t4 = $[16];
|
||||
}
|
||||
return t4;
|
||||
}
|
||||
function _temp4(prev_0) {
|
||||
return {
|
||||
...prev_0,
|
||||
fastMode: false
|
||||
};
|
||||
}
|
||||
function _temp3(s_1) {
|
||||
return s_1.fastMode;
|
||||
}
|
||||
function _temp2(s_0) {
|
||||
return s_0.mainLoopModelForSession;
|
||||
}
|
||||
function _temp(s) {
|
||||
return s.mainLoopModel;
|
||||
|
||||
return (
|
||||
<ModelPicker
|
||||
initial={mainLoopModel}
|
||||
sessionModel={mainLoopModelForSession}
|
||||
onSelect={handleSelect}
|
||||
onCancel={handleCancel}
|
||||
isStandaloneCommand
|
||||
showFastModeNotice={
|
||||
isFastModeEnabled() &&
|
||||
isFastMode &&
|
||||
isFastModeSupportedByModel(mainLoopModel) &&
|
||||
isFastModeAvailable()
|
||||
}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function SetModelAndClose({
|
||||
args,
|
||||
onDone
|
||||
onDone,
|
||||
}: {
|
||||
args: string;
|
||||
onDone: (result?: string, options?: {
|
||||
display?: CommandResultDisplay;
|
||||
}) => void;
|
||||
args: string
|
||||
onDone: (
|
||||
result?: string,
|
||||
options?: { display?: CommandResultDisplay },
|
||||
) => void
|
||||
}): React.ReactNode {
|
||||
const isFastMode = useAppState(s => s.fastMode);
|
||||
const setAppState = useSetAppState();
|
||||
const model = args === 'default' ? null : args;
|
||||
const isFastMode = useAppState(s => s.fastMode)
|
||||
const setAppState = useSetAppState()
|
||||
const model = args === 'default' ? null : args
|
||||
|
||||
React.useEffect(() => {
|
||||
async function handleModelChange(): Promise<void> {
|
||||
if (model && !isModelAllowed(model)) {
|
||||
onDone(`Model '${model}' is not available. Your organization restricts model selection.`, {
|
||||
display: 'system'
|
||||
});
|
||||
return;
|
||||
onDone(
|
||||
`Model '${model}' is not available. Your organization restricts model selection.`,
|
||||
{ display: 'system' },
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
// @[MODEL LAUNCH]: Update check for 1M access.
|
||||
if (model && isOpus1mUnavailable(model)) {
|
||||
onDone(`Opus 4.6 with 1M context is not available for your account. Learn more: https://code.claude.com/docs/en/model-config#extended-context-with-1m`, {
|
||||
display: 'system'
|
||||
});
|
||||
return;
|
||||
onDone(
|
||||
`Opus 4.6 with 1M context is not available for your account. Learn more: https://code.claude.com/docs/en/model-config#extended-context-with-1m`,
|
||||
{ display: 'system' },
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
if (model && isSonnet1mUnavailable(model)) {
|
||||
onDone(`Sonnet 4.6 with 1M context is not available for your account. Learn more: https://code.claude.com/docs/en/model-config#extended-context-with-1m`, {
|
||||
display: 'system'
|
||||
});
|
||||
return;
|
||||
onDone(
|
||||
`Sonnet 4.6 with 1M context is not available for your account. Learn more: https://code.claude.com/docs/en/model-config#extended-context-with-1m`,
|
||||
{ display: 'system' },
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
// Skip validation for default model
|
||||
if (!model) {
|
||||
setModel(null);
|
||||
return;
|
||||
setModel(null)
|
||||
return
|
||||
}
|
||||
|
||||
// Skip validation for known aliases - they're predefined and should work
|
||||
if (isKnownAlias(model)) {
|
||||
setModel(model);
|
||||
return;
|
||||
setModel(model)
|
||||
return
|
||||
}
|
||||
|
||||
// Validate and set custom model
|
||||
try {
|
||||
// Don't use parseUserSpecifiedModel for non-aliases since it lowercases the input
|
||||
// and model names are case-sensitive
|
||||
const {
|
||||
valid,
|
||||
error: error_0
|
||||
} = await validateModel(model);
|
||||
const { valid, error } = await validateModel(model)
|
||||
|
||||
if (valid) {
|
||||
setModel(model);
|
||||
setModel(model)
|
||||
} else {
|
||||
onDone(error_0 || `Model '${model}' not found`, {
|
||||
display: 'system'
|
||||
});
|
||||
onDone(error || `Model '${model}' not found`, {
|
||||
display: 'system',
|
||||
})
|
||||
}
|
||||
} catch (error) {
|
||||
onDone(`Failed to validate model: ${(error as Error).message}`, {
|
||||
display: 'system'
|
||||
});
|
||||
display: 'system',
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function setModel(modelValue: string | null): void {
|
||||
setAppState(prev => ({
|
||||
...prev,
|
||||
mainLoopModel: modelValue,
|
||||
mainLoopModelForSession: null
|
||||
}));
|
||||
let message = `Set model to ${chalk.bold(renderModelLabel(modelValue))}`;
|
||||
let wasFastModeToggledOn = undefined;
|
||||
mainLoopModelForSession: null,
|
||||
}))
|
||||
let message = `Set model to ${chalk.bold(renderModelLabel(modelValue))}`
|
||||
|
||||
let wasFastModeToggledOn = undefined
|
||||
if (isFastModeEnabled()) {
|
||||
clearFastModeCooldown();
|
||||
clearFastModeCooldown()
|
||||
if (!isFastModeSupportedByModel(modelValue) && isFastMode) {
|
||||
setAppState(prev_0 => ({
|
||||
...prev_0,
|
||||
fastMode: false
|
||||
}));
|
||||
wasFastModeToggledOn = false;
|
||||
setAppState(prev => ({
|
||||
...prev,
|
||||
fastMode: false,
|
||||
}))
|
||||
wasFastModeToggledOn = false
|
||||
// Do not update fast mode in settings since this is an automatic downgrade
|
||||
} else if (isFastModeSupportedByModel(modelValue) && isFastMode) {
|
||||
message += ` · Fast mode ON`;
|
||||
wasFastModeToggledOn = true;
|
||||
message += ` · Fast mode ON`
|
||||
wasFastModeToggledOn = true
|
||||
}
|
||||
}
|
||||
if (isBilledAsExtraUsage(modelValue, wasFastModeToggledOn === true, isOpus1mMergeEnabled())) {
|
||||
message += ` · Billed as extra usage`;
|
||||
|
||||
if (
|
||||
isBilledAsExtraUsage(
|
||||
modelValue,
|
||||
wasFastModeToggledOn === true,
|
||||
isOpus1mMergeEnabled(),
|
||||
)
|
||||
) {
|
||||
message += ` · Billed as extra usage`
|
||||
}
|
||||
|
||||
if (wasFastModeToggledOn === false) {
|
||||
// Fast mode was toggled off, show suffix after extra usage billing
|
||||
message += ` · Fast mode OFF`;
|
||||
message += ` · Fast mode OFF`
|
||||
}
|
||||
onDone(message);
|
||||
|
||||
onDone(message)
|
||||
}
|
||||
void handleModelChange();
|
||||
}, [model, onDone, setAppState]);
|
||||
return null;
|
||||
|
||||
void handleModelChange()
|
||||
}, [model, onDone, setAppState])
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
function isKnownAlias(model: string): boolean {
|
||||
return (MODEL_ALIASES as readonly string[]).includes(model.toLowerCase().trim());
|
||||
return (MODEL_ALIASES as readonly string[]).includes(
|
||||
model.toLowerCase().trim(),
|
||||
)
|
||||
}
|
||||
|
||||
function isOpus1mUnavailable(model: string): boolean {
|
||||
const m = model.toLowerCase();
|
||||
return !checkOpus1mAccess() && !isOpus1mMergeEnabled() && m.includes('opus') && m.includes('[1m]');
|
||||
const m = model.toLowerCase()
|
||||
return (
|
||||
!checkOpus1mAccess() &&
|
||||
!isOpus1mMergeEnabled() &&
|
||||
m.includes('opus') &&
|
||||
m.includes('[1m]')
|
||||
)
|
||||
}
|
||||
|
||||
function isSonnet1mUnavailable(model: string): boolean {
|
||||
const m = model.toLowerCase();
|
||||
const m = model.toLowerCase()
|
||||
// Warn about Sonnet and Sonnet 4.6, but not Sonnet 4.5 since that had
|
||||
// a different access criteria.
|
||||
return !checkSonnet1mAccess() && (m.includes('sonnet[1m]') || m.includes('sonnet-4-6[1m]'));
|
||||
return (
|
||||
!checkSonnet1mAccess() &&
|
||||
(m.includes('sonnet[1m]') || m.includes('sonnet-4-6[1m]'))
|
||||
)
|
||||
}
|
||||
function ShowModelAndClose(t0) {
|
||||
const {
|
||||
onDone
|
||||
} = t0;
|
||||
const mainLoopModel = useAppState(_temp7);
|
||||
const mainLoopModelForSession = useAppState(_temp8);
|
||||
const effortValue = useAppState(_temp9);
|
||||
const displayModel = renderModelLabel(mainLoopModel);
|
||||
const effortInfo = effortValue !== undefined ? ` (effort: ${effortValue})` : "";
|
||||
|
||||
function ShowModelAndClose({
|
||||
onDone,
|
||||
}: {
|
||||
onDone: (result?: string) => void
|
||||
}): React.ReactNode {
|
||||
const mainLoopModel = useAppState(s => s.mainLoopModel)
|
||||
const mainLoopModelForSession = useAppState(s => s.mainLoopModelForSession)
|
||||
const effortValue = useAppState(s => s.effortValue)
|
||||
const displayModel = renderModelLabel(mainLoopModel)
|
||||
const effortInfo =
|
||||
effortValue !== undefined ? ` (effort: ${effortValue})` : ''
|
||||
|
||||
if (mainLoopModelForSession) {
|
||||
onDone(`Current model: ${chalk.bold(renderModelLabel(mainLoopModelForSession))} (session override from plan mode)\nBase model: ${displayModel}${effortInfo}`);
|
||||
onDone(
|
||||
`Current model: ${chalk.bold(renderModelLabel(mainLoopModelForSession))} (session override from plan mode)\nBase model: ${displayModel}${effortInfo}`,
|
||||
)
|
||||
} else {
|
||||
onDone(`Current model: ${displayModel}${effortInfo}`);
|
||||
onDone(`Current model: ${displayModel}${effortInfo}`)
|
||||
}
|
||||
return null;
|
||||
}
|
||||
function _temp9(s_1) {
|
||||
return s_1.effortValue;
|
||||
}
|
||||
function _temp8(s_0) {
|
||||
return s_0.mainLoopModelForSession;
|
||||
}
|
||||
function _temp7(s) {
|
||||
return s.mainLoopModel;
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
export const call: LocalJSXCommandCall = async (onDone, _context, args) => {
|
||||
args = args?.trim() || '';
|
||||
args = args?.trim() || ''
|
||||
if (COMMON_INFO_ARGS.includes(args)) {
|
||||
logEvent('tengu_model_command_inline_help', {
|
||||
args: args as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS
|
||||
});
|
||||
return <ShowModelAndClose onDone={onDone} />;
|
||||
args: args as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
|
||||
})
|
||||
return <ShowModelAndClose onDone={onDone} />
|
||||
}
|
||||
if (COMMON_HELP_ARGS.includes(args)) {
|
||||
onDone('Run /model to open the model selection menu, or /model [modelName] to set the model.', {
|
||||
display: 'system'
|
||||
});
|
||||
return;
|
||||
onDone(
|
||||
'Run /model to open the model selection menu, or /model [modelName] to set the model.',
|
||||
{ display: 'system' },
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
if (args) {
|
||||
logEvent('tengu_model_command_inline', {
|
||||
args: args as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS
|
||||
});
|
||||
return <SetModelAndClose args={args} onDone={onDone} />;
|
||||
args: args as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
|
||||
})
|
||||
return <SetModelAndClose args={args} onDone={onDone} />
|
||||
}
|
||||
return <ModelPickerWrapper onDone={onDone} />;
|
||||
};
|
||||
function renderModelLabel(model: string | null): string {
|
||||
const rendered = renderDefaultModelSetting(model ?? getDefaultMainLoopModelSetting());
|
||||
return model === null ? `${rendered} (default)` : rendered;
|
||||
|
||||
return <ModelPickerWrapper onDone={onDone} />
|
||||
}
|
||||
|
||||
function renderModelLabel(model: string | null): string {
|
||||
const rendered = renderDefaultModelSetting(
|
||||
model ?? getDefaultMainLoopModelSetting(),
|
||||
)
|
||||
return model === null ? `${rendered} (default)` : rendered
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user