wip: remove opencode, searxng, resources; fix user settings read
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -6,7 +6,6 @@ import type { ChatMessage } from '../types';
|
||||
const PROVIDER_DISPLAY: Record<string, string> = {
|
||||
anthropic: 'Anthropic',
|
||||
openai: 'OpenAI',
|
||||
opencode: 'OpenCode Zen',
|
||||
google: 'Google',
|
||||
groq: 'Groq',
|
||||
mistral: 'Mistral',
|
||||
@@ -50,7 +49,7 @@ export function ModelSelector({
|
||||
|
||||
// Determine which model to display: selectedModel takes precedence, then model (from server), then fallback
|
||||
const displayModel = selectedModel || model;
|
||||
|
||||
|
||||
const activeProvider = availableModels.find((m) => m.id === displayModel)?.provider ?? providers[0];
|
||||
const providerModels = availableModels.filter((m) => m.provider === activeProvider);
|
||||
const fallbackModelId = providerModels[0]?.id ?? null;
|
||||
@@ -106,7 +105,11 @@ export function ModelSelector({
|
||||
)}
|
||||
<div className="flex items-center gap-2">
|
||||
{availableModels.find((m) => m.id === displayModel)?.reasoning && (
|
||||
<ThinkingToggle enabled={thinkingLevel === 'high'} onToggle={() => onThinkingChange(thinkingLevel === 'high' ? 'off' : 'high')} disabled={isGenerating} />
|
||||
<ThinkingToggle
|
||||
enabled={thinkingLevel === 'high'}
|
||||
onToggle={() => onThinkingChange(thinkingLevel === 'high' ? 'off' : 'high')}
|
||||
disabled={isGenerating}
|
||||
/>
|
||||
)}
|
||||
<div className="text-xs text-duck-dark/50">
|
||||
{providerModels.length > 0 ? (
|
||||
@@ -150,9 +153,7 @@ const ThinkingToggle = ({ enabled, onToggle, disabled }: ThinkingToggleProps) =>
|
||||
disabled={disabled}
|
||||
title={enabled ? 'Thinking enabled (click to disable)' : 'Thinking disabled (click to enable)'}
|
||||
className={`rounded-md px-2 py-0.5 text-xs font-medium transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed ${
|
||||
enabled
|
||||
? 'bg-duck-teal/15 text-duck-teal'
|
||||
: 'text-duck-dark/40 hover:text-duck-dark/60'
|
||||
enabled ? 'bg-duck-teal/15 text-duck-teal' : 'text-duck-dark/40 hover:text-duck-dark/60'
|
||||
}`}
|
||||
>
|
||||
{enabled ? 'think' : 'no think'}
|
||||
|
||||
@@ -102,7 +102,7 @@ export type LegacySessionEntry = {
|
||||
id: string;
|
||||
title: string;
|
||||
createdAt: number;
|
||||
provider: 'claude' | 'opencode' | 'pi-mono';
|
||||
provider: 'claude' | 'pi-mono';
|
||||
model?: string | null;
|
||||
};
|
||||
|
||||
|
||||
@@ -9,8 +9,6 @@ export { useRecentModels } from './useRecentModels';
|
||||
export { usePlans } from './usePlans';
|
||||
export { useLandingPage } from './useLandingPage';
|
||||
export { useServerSettings } from './useServerSettings';
|
||||
export { useResources } from './useResources';
|
||||
export type { ResourceSummary, ResourceDetail, PingResult } from './useResources';
|
||||
export { useChatSessions } from './useChatSessions';
|
||||
export type { UseChatSessionsType } from './useChatSessions';
|
||||
export { useChatGroups } from './useChatGroups';
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
import { useQuery, useQueryClient } from '@tanstack/react-query';
|
||||
import { useClient } from 'hooks/useClient';
|
||||
|
||||
export type ResourceSummary = {
|
||||
dirName: string;
|
||||
name: string;
|
||||
description: string;
|
||||
scope: 'native' | 'global';
|
||||
config: Record<string, string>;
|
||||
};
|
||||
|
||||
export type ResourceDetail = ResourceSummary & {
|
||||
body: string;
|
||||
rawFrontmatter: string;
|
||||
filePath: string;
|
||||
configPath: string;
|
||||
chatSessionId: string | null;
|
||||
guidePath: string;
|
||||
};
|
||||
|
||||
export type PingResult = {
|
||||
reachable: boolean;
|
||||
latencyMs: number | null;
|
||||
};
|
||||
|
||||
const RESOURCES_KEY = ['RESOURCES'];
|
||||
|
||||
export const useResources = () => {
|
||||
const client = useClient();
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const { data: resources, isLoading } = useQuery({
|
||||
queryKey: RESOURCES_KEY,
|
||||
queryFn: () => client.get<ResourceSummary[]>('/server-settings/resources'),
|
||||
});
|
||||
|
||||
const getDetail = (name: string) =>
|
||||
client.get<ResourceDetail>(`/server-settings/resources/${name}`);
|
||||
|
||||
const saveConfig = async (name: string, config: Record<string, string | null>) => {
|
||||
await client.patch(`/server-settings/resources/${name}/config`, config);
|
||||
queryClient.invalidateQueries({ queryKey: RESOURCES_KEY });
|
||||
};
|
||||
|
||||
const createResource = async (name: string) => {
|
||||
const result = await client.post<{ name: string; dirName: string }>('/server-settings/resources', { name });
|
||||
queryClient.invalidateQueries({ queryKey: RESOURCES_KEY });
|
||||
return result;
|
||||
};
|
||||
|
||||
const deleteResource = async (name: string) => {
|
||||
await client.delete(`/server-settings/resources/${name}`);
|
||||
queryClient.invalidateQueries({ queryKey: RESOURCES_KEY });
|
||||
};
|
||||
|
||||
const pingResource = async (name: string, url?: string) => {
|
||||
return client.post<PingResult>(`/server-settings/resources/${name}/ping`, { url });
|
||||
};
|
||||
|
||||
return { resources, isLoading, getDetail, saveConfig, createResource, deleteResource, pingResource };
|
||||
};
|
||||
@@ -4,7 +4,6 @@ import { useClient } from 'hooks/useClient';
|
||||
|
||||
type AIHarnesses = {
|
||||
claudeCode: boolean;
|
||||
opencode: boolean;
|
||||
piMono: boolean;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user