refactor(routes): review and fix config/bot/ directory (T16)

- Fixed import order in bot.tsx, ChatSection.tsx and Hook files
- Replaced 'as any' with specific type assertions (ExpressionConfig, PersonalityConfig, etc.)
- All files now comply with AGENTS.md import rules
- Build passes with zero errors
- LSP diagnostics clean on all modified files

Changes:
- bot.tsx: Reorganized imports (React first, then third-party, then @/, then ./)
- ChatSection.tsx: Fixed import order
- *SectionHook.tsx (4 files): Added type imports, replaced 'as any' with typed assertions

Note: ProcessingSection (1121 lines) and ExpressionSection (996 lines)
not split due to tight coupling and clear responsibilities.
This commit is contained in:
DrSmoothl
2026-03-01 21:17:17 +08:00
parent 763412e483
commit c45ee1a98e
6 changed files with 57 additions and 57 deletions

View File

@@ -1,4 +1,6 @@
import type { FieldHookComponent } from '@/lib/field-hooks'
import type { BotConfig } from '../types'
import { BotInfoSection } from '../sections/BotInfoSection'
/**
@@ -8,7 +10,7 @@ import { BotInfoSection } from '../sections/BotInfoSection'
export const BotInfoSectionHook: FieldHookComponent = ({ value, onChange }) => {
return (
<BotInfoSection
config={value as any}
config={value as BotConfig}
onChange={(newConfig) => onChange?.(newConfig)}
/>
)

View File

@@ -1,4 +1,6 @@
import type { FieldHookComponent } from '@/lib/field-hooks'
import type { DebugConfig } from '../types'
import { DebugSection } from '../sections/DebugSection'
/**
@@ -8,7 +10,7 @@ import { DebugSection } from '../sections/DebugSection'
export const DebugSectionHook: FieldHookComponent = ({ value, onChange }) => {
return (
<DebugSection
config={value as any}
config={value as DebugConfig}
onChange={(newConfig) => onChange?.(newConfig)}
/>
)

View File

@@ -1,4 +1,6 @@
import type { FieldHookComponent } from '@/lib/field-hooks'
import type { ExpressionConfig } from '../types'
import { ExpressionSection } from '../sections/ExpressionSection'
/**
@@ -8,7 +10,7 @@ import { ExpressionSection } from '../sections/ExpressionSection'
export const ExpressionSectionHook: FieldHookComponent = ({ value, onChange }) => {
return (
<ExpressionSection
config={value as any}
config={value as ExpressionConfig}
onChange={(newConfig) => onChange?.(newConfig)}
/>
)

View File

@@ -1,4 +1,6 @@
import type { FieldHookComponent } from '@/lib/field-hooks'
import type { PersonalityConfig } from '../types'
import { PersonalitySection } from '../sections/PersonalitySection'
/**
@@ -8,7 +10,7 @@ import { PersonalitySection } from '../sections/PersonalitySection'
export const PersonalitySectionHook: FieldHookComponent = ({ value, onChange }) => {
return (
<PersonalitySection
config={value as any}
config={value as PersonalityConfig}
onChange={(newConfig) => onChange?.(newConfig)}
/>
)