Complete frontend migration to unified Pi harness (Phase 7 + Phase 9)

- Delete legacy hooks: useClaude.ts, useOpenCode.ts, usePiMono.ts, App.backup.tsx
- Update all components to use usePi instead of legacy hooks
- Replace useVisiblePiMonoModels/useClaudeModels/useOpenCodeModels with useVisiblePiModels
- Migrate from LegacyChatMessage to ChatMessage type throughout
- Update SessionBar to remove provider and archive props
- Simplify ChatDetailPanel to Pi-only (remove Claude/OpenCode components)
- Fix useChatSessions calls (remove provider parameter)
- Update user-settings types: provider now only 'pi' instead of legacy values
- Update PI_HARNESS_REBUILD.md to mark phases complete
This commit is contained in:
2026-02-20 21:42:26 +00:00
parent 92f4b2be8e
commit ba51ee0320
31 changed files with 225 additions and 1176 deletions
@@ -23,7 +23,7 @@ import {
DropdownMenuTrigger,
} from '@/components/ui/dropdown-menu';
import { useSettings } from '@/state/useSettings';
import { useVisiblePiMonoModels } from '@/state/useModels';
import { useVisiblePiModels, type ModelOption } from '@/state/useModels';
import type { Attachment } from '@/Screens/Dashboard/Chat/EmbeddableChat';
const PROVIDER_DISPLAY: Record<string, string> = {
@@ -46,7 +46,7 @@ const PROVIDER_DISPLAY: Record<string, string> = {
export const ChatLauncher = () => {
const navigate = useNavigate();
const { settings } = useSettings();
const piMonoModels = useVisiblePiMonoModels();
const piModels = useVisiblePiModels();
const client = useClient();
const [model, setModel] = useState<string | null>(settings.chat.defaultModel);
@@ -62,17 +62,17 @@ export const ChatLauncher = () => {
}, [settings.chat.defaultModel]);
const providers = useMemo(
() => [...new Set(piMonoModels.map((m) => m.provider).filter(Boolean))] as string[],
[piMonoModels],
() => [...new Set(piModels.map((m: ModelOption) => m.provider).filter(Boolean))] as string[],
[piModels],
);
const activeProvider = piMonoModels.find((m) => m.id === model)?.provider ?? providers[0];
const providerModels = piMonoModels.filter((m) => m.provider === activeProvider);
const activeProvider = piModels.find((m: ModelOption) => m.id === model)?.provider ?? providers[0];
const providerModels = piModels.filter((m: ModelOption) => m.provider === activeProvider);
const displayName = (provider: string) => PROVIDER_DISPLAY[provider] ?? provider;
const handleProviderClick = (provider: string) => {
const firstModel = piMonoModels.find((m) => m.provider === provider);
const firstModel = piModels.find((m: ModelOption) => m.provider === provider);
if (firstModel) setModel(firstModel.id);
};