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

+23
View File
@@ -0,0 +1,23 @@
import { useQuery } from '@tanstack/react-query'
import { API_BASE_URL } from '@/constants/api'
import type { FileInfo } from '@/types/files'
const API_BASE = API_BASE_URL
async function fetchFile(path: string): Promise<FileInfo> {
const response = await fetch(`${API_BASE}/api/files/${path}`)
if (!response.ok) {
throw new Error(`Failed to load file: ${response.statusText}`)
}
return response.json()
}
export function useFile(path: string | undefined) {
return useQuery({
queryKey: ['file', path],
queryFn: () => path ? fetchFile(path) : Promise.reject(new Error('No file path provided')),
enabled: !!path,
})
}
+1
View File
@@ -39,6 +39,7 @@ export interface Provider {
env: string[];
npm?: string;
models: Record<string, Model>;
options?: Record<string, unknown>;
}
export interface ProviderWithModels {