refactor: consolidate environment config and API handling

- Update database paths and port configuration
- Remove backend config.ts and sessions route
- Add mobile file preview and files API
- Clean up shared constants and provider hooks
This commit is contained in:
Chris Scott committed 2025-11-25 09:39:56 -05:00
1 parent 0db354048d
commit 8a56bc208d
32 files changed
+301 -512

No files matched your search

-58
View File
@@ -1,58 +0,0 @@
import { useQuery } from '@tanstack/react-query'
import axios from 'axios'
const OPENCODE_URL = `${window.location.protocol}//${window.location.hostname}:5551`
interface ProviderModel {
id: string
name: string
attachment?: boolean
reasoning?: boolean
temperature?: boolean
tool_call?: boolean
cost?: {
input: number
output: number
cache_read?: number
cache_write?: number
}
limit?: {
context: number
output: number
}
modalities?: {
input: string[]
output: string[]
}
options?: Record<string, unknown>
}
interface Provider {
id: string
name: string
npm?: string
env?: string[]
models: Record<string, ProviderModel>
options?: {
baseURL?: string
[key: string]: unknown
}
}
interface ProvidersResponse {
providers: Provider[]
default: Record<string, string>
}
export function useProviders() {
return useQuery({
queryKey: ['opencode-providers'],
queryFn: async (): Promise<Provider[]> => {
const { data } = await axios.get<ProvidersResponse>(
`${OPENCODE_URL}/config/providers`
)
return data.providers
},
staleTime: 30000,
})
}