mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 12:24:30 +01:00
regenerate OpenAPI spec and add model selection components
This commit is contained in:
1 parent
9ed292af2a
commit
17ee96d316
12 files changed
+10266
-3453
No files matched your search
+6299
-2611
File diff suppressed because it is too large.
Load diff
+3637
-818
File diff suppressed because it is too large.
Load diff
@@ -2,14 +2,14 @@ import axios, { type AxiosInstance } from 'axios'
|
||||
import type { paths } from './opencode-types'
|
||||
|
||||
type SessionListResponse = paths['/session']['get']['responses']['200']['content']['application/json']
|
||||
type SessionResponse = paths['/session/{id}']['get']['responses']['200']['content']['application/json']
|
||||
type SessionResponse = paths['/session/{sessionID}']['get']['responses']['200']['content']['application/json']
|
||||
type CreateSessionRequest = NonNullable<paths['/session']['post']['requestBody']>['content']['application/json']
|
||||
type MessageListResponse = paths['/session/{id}/message']['get']['responses']['200']['content']['application/json']
|
||||
type SendPromptRequest = NonNullable<paths['/session/{id}/message']['post']['requestBody']>['content']['application/json']
|
||||
type MessageListResponse = paths['/session/{sessionID}/message']['get']['responses']['200']['content']['application/json']
|
||||
type SendPromptRequest = NonNullable<paths['/session/{sessionID}/message']['post']['requestBody']>['content']['application/json']
|
||||
type ConfigResponse = paths['/config']['get']['responses']['200']['content']['application/json']
|
||||
type CommandListResponse = paths['/command']['get']['responses']['200']['content']['application/json']
|
||||
type CommandRequest = NonNullable<paths['/session/{id}/command']['post']['requestBody']>['content']['application/json']
|
||||
type ShellRequest = NonNullable<paths['/session/{id}/shell']['post']['requestBody']>['content']['application/json']
|
||||
type CommandRequest = NonNullable<paths['/session/{sessionID}/command']['post']['requestBody']>['content']['application/json']
|
||||
type ShellRequest = NonNullable<paths['/session/{sessionID}/shell']['post']['requestBody']>['content']['application/json']
|
||||
type AgentListResponse = paths['/agent']['get']['responses']['200']['content']['application/json']
|
||||
|
||||
export class OpenCodeClient {
|
||||
|
||||
@@ -48,6 +48,7 @@ export interface OpenCodeModel {
|
||||
pdf: boolean;
|
||||
};
|
||||
};
|
||||
variants?: Record<string, Record<string, unknown>>;
|
||||
}
|
||||
|
||||
export interface OpenCodeProvider {
|
||||
@@ -87,6 +88,7 @@ export interface Model {
|
||||
provider?: {
|
||||
npm: string;
|
||||
};
|
||||
variants?: Record<string, Record<string, unknown>>;
|
||||
}
|
||||
|
||||
export interface Provider {
|
||||
@@ -187,6 +189,7 @@ async function getProvidersFromOpenCodeServer(): Promise<{ providers: Provider[]
|
||||
provider: {
|
||||
npm: openCodeModel.api.npm,
|
||||
},
|
||||
variants: openCodeModel.variants,
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import { useCommands } from '@/hooks/useCommands'
|
||||
import { useCommandHandler } from '@/hooks/useCommandHandler'
|
||||
import { useFileSearch } from '@/hooks/useFileSearch'
|
||||
import { useModelSelection } from '@/hooks/useModelSelection'
|
||||
import { useVariants } from '@/hooks/useVariants'
|
||||
|
||||
import { useUserBash } from '@/stores/userBashStore'
|
||||
import { useMobile } from '@/hooks/useMobile'
|
||||
@@ -16,6 +17,7 @@ import { CommandSuggestions } from '@/components/command/CommandSuggestions'
|
||||
import { SquareFill } from '@/components/ui/square-fill'
|
||||
import { MentionSuggestions, type MentionItem } from './MentionSuggestions'
|
||||
import { SessionStatusIndicator } from '@/components/ui/session-status-indicator'
|
||||
import { ModelQuickSelect } from '@/components/model/ModelQuickSelect'
|
||||
import { detectMentionTrigger, parsePromptToParts, getFilename, filterAgentsByQuery } from '@/lib/promptParser'
|
||||
|
||||
|
||||
@@ -86,6 +88,7 @@ export const PromptInput = forwardRef<PromptInputHandle, PromptInputProps>(funct
|
||||
const [selectedMentionIndex, setSelectedMentionIndex] = useState(0)
|
||||
const [selectedCommandIndex, setSelectedCommandIndex] = useState(0)
|
||||
const [selectedAgent, setSelectedAgent] = useState<string | null>(null)
|
||||
const [isFocused, setIsFocused] = useState(false)
|
||||
|
||||
const textareaRef = useRef<HTMLTextAreaElement>(null)
|
||||
const fileInputRef = useRef<HTMLInputElement>(null)
|
||||
@@ -176,7 +179,8 @@ export const PromptInput = forwardRef<PromptInputHandle, PromptInputProps>(funct
|
||||
sessionID,
|
||||
parts,
|
||||
model: currentModel,
|
||||
agent: selectedAgent || currentMode
|
||||
agent: selectedAgent || currentMode,
|
||||
variant: currentVariant
|
||||
})
|
||||
setPrompt('')
|
||||
setAttachedFiles(new Map())
|
||||
@@ -228,7 +232,8 @@ export const PromptInput = forwardRef<PromptInputHandle, PromptInputProps>(funct
|
||||
sessionID,
|
||||
parts,
|
||||
model: currentModel,
|
||||
agent: selectedAgent || currentMode
|
||||
agent: selectedAgent || currentMode,
|
||||
variant: currentVariant
|
||||
})
|
||||
|
||||
setPrompt('')
|
||||
@@ -596,6 +601,11 @@ export const PromptInput = forwardRef<PromptInputHandle, PromptInputProps>(funct
|
||||
if (textareaRef.current) {
|
||||
textareaRef.current.style.height = 'auto'
|
||||
}
|
||||
} else if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === 't') {
|
||||
e.preventDefault()
|
||||
if (hasVariants) {
|
||||
cycleVariant()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -666,12 +676,13 @@ export const PromptInput = forwardRef<PromptInputHandle, PromptInputProps>(funct
|
||||
const modeBg = currentMode === 'plan' ? 'bg-yellow-500/20 border-yellow-400 hover:bg-yellow-500/30 hover:border-yellow-300' : 'bg-green-500/20 border-green-400 hover:bg-green-500/30 hover:border-green-300'
|
||||
const modeShadow = currentMode === 'plan' ? 'shadow-yellow-500/20 hover:shadow-yellow-500/30' : 'shadow-green-500/20 hover:shadow-green-500/30'
|
||||
|
||||
const { model, modelString } = useModelSelection(opcodeUrl, directory)
|
||||
const { model, modelString } = useModelSelection(opcodeUrl, directory)
|
||||
const currentModel = modelString || ''
|
||||
const displayModelName = model?.modelID || currentModel
|
||||
const isMobile = useMobile()
|
||||
const { setShowDialog, hasPermissionsForSession } = usePermissionContext()
|
||||
const hasPendingPermissionForSession = hasPermissionsForSession(sessionID)
|
||||
const { hasVariants, currentVariant, cycleVariant } = useVariants(opcodeUrl, directory)
|
||||
const sessionStatus = useSessionStatusForSession(sessionID)
|
||||
const isSessionActive = sessionStatus.type === 'busy' || sessionStatus.type === 'retry'
|
||||
const hasActiveStream = hasIncompleteMessages && isSessionActive
|
||||
@@ -694,7 +705,7 @@ export const PromptInput = forwardRef<PromptInputHandle, PromptInputProps>(funct
|
||||
|
||||
return (
|
||||
<div className={`relative backdrop-blur-md bg-background opacity-95 border border-border dark:border-white/30 rounded-xl p-2 md:p-3 mb-4 md:mb-1 w-full transition-all ${hasPendingPermissionForSession ? 'border-orange-500/50 ring-1 ring-orange-500/30' : ''}`}>
|
||||
{showStopButton && (
|
||||
{showStopButton && !(isFocused && prompt.trim().length > 0) && (
|
||||
<button
|
||||
onClick={handleStop}
|
||||
disabled={disabled}
|
||||
@@ -720,6 +731,8 @@ return (
|
||||
: "Send a message..."
|
||||
}
|
||||
disabled={disabled}
|
||||
onFocus={() => setIsFocused(true)}
|
||||
onBlur={() => setIsFocused(false)}
|
||||
className={`w-full bg-muted/50 pl-2 md:pl-3 pr-3 py-2 text-[16px] text-foreground placeholder-muted-foreground focus:outline-none focus:bg-muted/70 resize-none min-h-[40px] max-h-[120px] disabled:opacity-50 disabled:cursor-not-allowed md:text-sm rounded-lg ${
|
||||
isBashMode
|
||||
? 'border-purple-500/50 bg-purple-500/5 focus:bg-purple-500/10'
|
||||
@@ -766,14 +779,22 @@ return (
|
||||
</div>
|
||||
) : (
|
||||
!hideSecondaryButtons && (
|
||||
<button
|
||||
onClick={onShowModelsDialog}
|
||||
className="px-2.5 py-1.5 md:px-3 h-[36px] rounded-lg text-xs md:text-sm font-medium border bg-muted border-border text-muted-foreground hover:bg-muted-foreground/10 hover:border-foreground/30 transition-colors cursor-pointer max-w-[150px] md:max-w-[220px] truncate dark:border-white/30"
|
||||
<ModelQuickSelect
|
||||
opcodeUrl={opcodeUrl}
|
||||
directory={directory}
|
||||
onOpenFullDialog={() => onShowModelsDialog?.()}
|
||||
>
|
||||
{displayModelName || 'Select model'}
|
||||
</button>
|
||||
)
|
||||
)}
|
||||
<button
|
||||
className="px-2.5 py-0.5 md:px-3 min-h-[36px] rounded-lg text-xs md:text-sm font-medium border bg-muted border-border text-muted-foreground hover:bg-muted-foreground/10 hover:border-foreground/30 transition-colors cursor-pointer max-w-[150px] md:max-w-[220px] dark:border-white/30 flex flex-col items-start justify-center"
|
||||
>
|
||||
<span className="truncate w-full text-left">{displayModelName || 'Select model'}</span>
|
||||
{hasVariants && currentVariant && (
|
||||
<span className="text-[10px] text-orange-500 truncate w-full text-center capitalize">{currentVariant}</span>
|
||||
)}
|
||||
</button>
|
||||
</ModelQuickSelect>
|
||||
)
|
||||
)}
|
||||
|
||||
</div>
|
||||
<div className="flex items-center gap-1.5 md:gap-2 flex-shrink-0">
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
import { useMemo } from 'react'
|
||||
import { Check, ChevronRight, Clock, Sparkles } from 'lucide-react'
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuLabel,
|
||||
DropdownMenuSeparator,
|
||||
DropdownMenuTrigger,
|
||||
} from '@/components/ui/dropdown-menu'
|
||||
import { useModelSelection } from '@/hooks/useModelSelection'
|
||||
import { useVariants } from '@/hooks/useVariants'
|
||||
import { formatModelName } from '@/api/providers'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { useOpenCodeClient } from '@/hooks/useOpenCode'
|
||||
|
||||
interface ModelQuickSelectProps {
|
||||
opcodeUrl: string | null | undefined
|
||||
directory?: string
|
||||
onOpenFullDialog: () => void
|
||||
disabled?: boolean
|
||||
children: React.ReactNode
|
||||
}
|
||||
|
||||
export function ModelQuickSelect({
|
||||
opcodeUrl,
|
||||
directory,
|
||||
onOpenFullDialog,
|
||||
disabled,
|
||||
children,
|
||||
}: ModelQuickSelectProps) {
|
||||
const { modelString, recentModels, setModel } = useModelSelection(opcodeUrl, directory)
|
||||
const { availableVariants, currentVariant, setVariant, clearVariant, hasVariants } = useVariants(opcodeUrl, directory)
|
||||
const client = useOpenCodeClient(opcodeUrl, directory)
|
||||
|
||||
const { data: providersData } = useQuery({
|
||||
queryKey: ['opencode', 'providers', opcodeUrl, directory],
|
||||
queryFn: () => client!.getProviders(),
|
||||
enabled: !!client,
|
||||
staleTime: 30000,
|
||||
})
|
||||
|
||||
const recentModelsWithNames = useMemo(() => {
|
||||
if (!providersData?.all || recentModels.length === 0) return []
|
||||
|
||||
return recentModels
|
||||
.filter(recent => {
|
||||
const key = `${recent.providerID}/${recent.modelID}`
|
||||
return key !== modelString
|
||||
})
|
||||
.slice(0, 5)
|
||||
.map(recent => {
|
||||
let displayName = recent.modelID
|
||||
for (const provider of providersData.all) {
|
||||
if (provider.id === recent.providerID && provider.models) {
|
||||
const modelData = provider.models[recent.modelID]
|
||||
if (modelData) {
|
||||
displayName = formatModelName(modelData)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
...recent,
|
||||
displayName,
|
||||
key: `${recent.providerID}/${recent.modelID}`,
|
||||
}
|
||||
})
|
||||
}, [recentModels, providersData, modelString])
|
||||
|
||||
const handleVariantSelect = (variant: string | undefined) => {
|
||||
if (variant === undefined) {
|
||||
clearVariant()
|
||||
} else {
|
||||
setVariant(variant)
|
||||
}
|
||||
}
|
||||
|
||||
const handleModelSelect = (providerID: string, modelID: string) => {
|
||||
setModel({ providerID, modelID })
|
||||
}
|
||||
|
||||
const hasRecents = recentModelsWithNames.length > 0
|
||||
|
||||
return (
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild disabled={disabled}>
|
||||
{children}
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="start" className="w-56">
|
||||
{hasVariants && (
|
||||
<>
|
||||
<DropdownMenuLabel className="flex items-center gap-1.5">
|
||||
<Sparkles className="h-3 w-3" />
|
||||
Thinking Effort
|
||||
</DropdownMenuLabel>
|
||||
<DropdownMenuItem
|
||||
onClick={() => handleVariantSelect(undefined)}
|
||||
className="flex items-center justify-between"
|
||||
>
|
||||
<span>Default</span>
|
||||
{!currentVariant && <Check className="h-4 w-4" />}
|
||||
</DropdownMenuItem>
|
||||
{availableVariants.map((variant) => (
|
||||
<DropdownMenuItem
|
||||
key={variant}
|
||||
onClick={() => handleVariantSelect(variant)}
|
||||
className="flex items-center justify-between"
|
||||
>
|
||||
<span className="capitalize text-orange-500 text-center">{variant}</span>
|
||||
{currentVariant === variant && <Check className="h-4 w-4" />}
|
||||
</DropdownMenuItem>
|
||||
))}
|
||||
{hasRecents && <DropdownMenuSeparator />}
|
||||
</>
|
||||
)}
|
||||
|
||||
{hasRecents && (
|
||||
<>
|
||||
<DropdownMenuLabel className="flex items-center gap-1.5">
|
||||
<Clock className="h-3 w-3" />
|
||||
Recent Models
|
||||
</DropdownMenuLabel>
|
||||
{recentModelsWithNames.map((recent) => (
|
||||
<DropdownMenuItem
|
||||
key={recent.key}
|
||||
onClick={() => handleModelSelect(recent.providerID, recent.modelID)}
|
||||
className="flex items-center justify-between"
|
||||
>
|
||||
<span className="truncate">{recent.displayName}</span>
|
||||
{modelString === recent.key && <Check className="h-4 w-4" />}
|
||||
</DropdownMenuItem>
|
||||
))}
|
||||
<DropdownMenuSeparator />
|
||||
</>
|
||||
)}
|
||||
|
||||
<DropdownMenuItem
|
||||
onClick={onOpenFullDialog}
|
||||
className="flex items-center justify-between"
|
||||
>
|
||||
<span>All Models...</span>
|
||||
<ChevronRight className="h-4 w-4" />
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
)
|
||||
}
|
||||
@@ -252,12 +252,14 @@ export const useSendPrompt = (opcodeUrl: string | null | undefined, directory?:
|
||||
parts,
|
||||
model,
|
||||
agent,
|
||||
variant,
|
||||
}: {
|
||||
sessionID: string;
|
||||
prompt?: string;
|
||||
parts?: ContentPart[];
|
||||
model?: string;
|
||||
agent?: string;
|
||||
variant?: string;
|
||||
}) => {
|
||||
if (!client) throw new Error("No client available");
|
||||
|
||||
@@ -312,6 +314,10 @@ export const useSendPrompt = (opcodeUrl: string | null | undefined, directory?:
|
||||
requestData.agent = agent;
|
||||
}
|
||||
|
||||
if (variant) {
|
||||
requestData.variant = variant;
|
||||
}
|
||||
|
||||
const response = await client.sendPrompt(sessionID, requestData);
|
||||
|
||||
return { optimisticUserID, response, userPromptText };
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
import { useMemo } from 'react'
|
||||
import { useModelSelection } from './useModelSelection'
|
||||
import { useModelStore } from '@/stores/modelStore'
|
||||
import { useOpenCodeClient } from './useOpenCode'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
|
||||
export interface UseVariantsResult {
|
||||
availableVariants: string[]
|
||||
currentVariant: string | undefined
|
||||
setVariant: (variant: string | undefined) => void
|
||||
cycleVariant: () => void
|
||||
clearVariant: () => void
|
||||
hasVariants: boolean
|
||||
}
|
||||
|
||||
export function useVariants(
|
||||
opcodeUrl: string | null | undefined,
|
||||
directory?: string
|
||||
): UseVariantsResult {
|
||||
const { model } = useModelSelection(opcodeUrl, directory)
|
||||
const { setVariant: setStoreVariant, clearVariant: clearStoreVariant } = useModelStore()
|
||||
const client = useOpenCodeClient(opcodeUrl, directory)
|
||||
|
||||
const { data: providersData, isLoading } = useQuery({
|
||||
queryKey: ['opencode', 'providers', opcodeUrl, directory],
|
||||
queryFn: () => client!.getProviders(),
|
||||
enabled: !!client && !!model,
|
||||
staleTime: 30000,
|
||||
})
|
||||
|
||||
const currentModel = useMemo(() => {
|
||||
if (!model || isLoading || !providersData?.all) return null
|
||||
for (const provider of providersData.all) {
|
||||
if (provider.id === model.providerID && provider.models) {
|
||||
const modelData = provider.models[model.modelID]
|
||||
if (modelData) {
|
||||
return modelData
|
||||
}
|
||||
}
|
||||
}
|
||||
return null
|
||||
}, [model, providersData, isLoading])
|
||||
|
||||
const availableVariants = useMemo(() => {
|
||||
if (!currentModel?.variants) return []
|
||||
return Object.keys(currentModel.variants)
|
||||
}, [currentModel])
|
||||
|
||||
const currentVariant = useModelStore((state) =>
|
||||
model ? state.variants[`${model.providerID}/${model.modelID}`] : undefined
|
||||
)
|
||||
|
||||
const setVariant = useMemo(
|
||||
() => (variant: string | undefined) => {
|
||||
if (!model) return
|
||||
setStoreVariant(model, variant)
|
||||
},
|
||||
[model, setStoreVariant],
|
||||
)
|
||||
|
||||
const cycleVariant = useMemo(() => {
|
||||
return () => {
|
||||
if (!model || availableVariants.length === 0) return
|
||||
|
||||
if (!currentVariant) {
|
||||
setStoreVariant(model, availableVariants[0])
|
||||
} else {
|
||||
const currentIndex = availableVariants.indexOf(currentVariant)
|
||||
if (currentIndex === availableVariants.length - 1) {
|
||||
clearStoreVariant(model)
|
||||
} else {
|
||||
setStoreVariant(model, availableVariants[currentIndex + 1])
|
||||
}
|
||||
}
|
||||
}
|
||||
}, [model, availableVariants, currentVariant, setStoreVariant, clearStoreVariant])
|
||||
|
||||
const clearVariant = useMemo(
|
||||
() => () => {
|
||||
if (!model) return
|
||||
clearStoreVariant(model)
|
||||
},
|
||||
[model, clearStoreVariant],
|
||||
)
|
||||
|
||||
return {
|
||||
availableVariants,
|
||||
currentVariant,
|
||||
setVariant,
|
||||
cycleVariant,
|
||||
clearVariant,
|
||||
hasVariants: availableVariants.length > 0,
|
||||
}
|
||||
}
|
||||
@@ -9,11 +9,15 @@ export interface ModelSelection {
|
||||
interface ModelStore {
|
||||
model: ModelSelection | null
|
||||
recentModels: ModelSelection[]
|
||||
variants: Record<string, string | undefined>
|
||||
isInitialized: boolean
|
||||
|
||||
|
||||
setModel: (model: ModelSelection) => void
|
||||
initializeFromConfig: (configModel: string | undefined) => void
|
||||
getModelString: () => string | null
|
||||
setVariant: (model: ModelSelection, variant: string | undefined) => void
|
||||
getVariant: (model: ModelSelection) => string | undefined
|
||||
clearVariant: (model: ModelSelection) => void
|
||||
}
|
||||
|
||||
const MAX_RECENT_MODELS = 10
|
||||
@@ -30,6 +34,7 @@ export const useModelStore = create<ModelStore>()(
|
||||
(set, get) => ({
|
||||
model: null,
|
||||
recentModels: [],
|
||||
variants: {},
|
||||
isInitialized: false,
|
||||
|
||||
setModel: (model: ModelSelection) => {
|
||||
@@ -67,13 +72,43 @@ export const useModelStore = create<ModelStore>()(
|
||||
if (!model) return null
|
||||
return `${model.providerID}/${model.modelID}`
|
||||
},
|
||||
|
||||
setVariant: (model: ModelSelection, variant: string | undefined) => {
|
||||
set((state) => {
|
||||
const key = `${model.providerID}/${model.modelID}`
|
||||
return {
|
||||
variants: {
|
||||
...state.variants,
|
||||
[key]: variant,
|
||||
},
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
getVariant: (model: ModelSelection) => {
|
||||
const state = get()
|
||||
const key = `${model.providerID}/${model.modelID}`
|
||||
return state.variants[key]
|
||||
},
|
||||
|
||||
clearVariant: (model: ModelSelection) => {
|
||||
set((state) => {
|
||||
const key = `${model.providerID}/${model.modelID}`
|
||||
const newVariants = { ...state.variants }
|
||||
delete newVariants[key]
|
||||
return {
|
||||
variants: newVariants,
|
||||
}
|
||||
})
|
||||
},
|
||||
}),
|
||||
{
|
||||
name: 'opencode-model-selection',
|
||||
partialize: (state) => ({
|
||||
model: state.model,
|
||||
recentModels: state.recentModels,
|
||||
variants: state.variants,
|
||||
}),
|
||||
}
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -61,8 +61,7 @@ export const useSessionStatus = create<SessionStatusStore>((set, get) => ({
|
||||
}))
|
||||
|
||||
export const useSessionStatusForSession = (sessionID: string | undefined): SessionStatusType => {
|
||||
const status = useSessionStatus((state) =>
|
||||
sessionID ? state.statuses.get(sessionID) : undefined
|
||||
return useSessionStatus((state) =>
|
||||
sessionID ? (state.statuses.get(sessionID) ?? DEFAULT_STATUS) : DEFAULT_STATUS
|
||||
)
|
||||
return status || DEFAULT_STATUS
|
||||
}
|
||||
@@ -3,12 +3,11 @@
|
||||
import { writeFile } from 'fs/promises'
|
||||
import { join, dirname } from 'path'
|
||||
import { fileURLToPath } from 'url'
|
||||
import {ENV} from '../backend/src/config'
|
||||
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url))
|
||||
|
||||
const OPENCODE_URL = ENV.VITE_API_URL + '/api/opencode'
|
||||
const API_URL = process.env.VITE_API_URL || 'http://localhost:8001'
|
||||
const OPENCODE_URL = API_URL + '/api/opencode'
|
||||
|
||||
async function generateOpenAPISpec() {
|
||||
console.log(`📥 Fetching OpenAPI spec from ${OPENCODE_URL}/doc`)
|
||||
|
||||
@@ -60,6 +60,7 @@ export const DEFAULT_KEYBOARD_SHORTCUTS: Record<string, string> = {
|
||||
closeSession: 'W',
|
||||
toggleSidebar: 'B',
|
||||
selectModel: 'M',
|
||||
variantCycle: `${CMD_KEY}+T`,
|
||||
};
|
||||
|
||||
export const GitCredentialSchema = z.object({
|
||||
|
||||
Reference in new issue
Block a user