refactor: move routes under /tori/ prefix and add /api/obj mount
Routes now live at /tori/api, /ws/tori, and static files at /tori/. Root / redirects to /tori/. Object storage mounted at /api/obj. Dev proxy updated accordingly.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import type { Project, Workflow, ExecutionLogEntry, Comment, Timer, KbArticle, KbArticleSummary, PlanStepInfo, LlmCallLogEntry } from './types'
|
||||
|
||||
const BASE = '/api'
|
||||
const BASE = `${import.meta.env.BASE_URL.replace(/\/$/, '')}/api`
|
||||
|
||||
async function request<T>(path: string, options?: RequestInit): Promise<T> {
|
||||
const res = await fetch(`${BASE}${path}`, {
|
||||
@@ -102,4 +102,12 @@ export const api = {
|
||||
|
||||
deleteArticle: (id: string) =>
|
||||
request<boolean>(`/kb/articles/${id}`, { method: 'DELETE' }),
|
||||
|
||||
getSettings: () => request<Record<string, string>>('/settings'),
|
||||
|
||||
putSetting: (key: string, value: string) =>
|
||||
request<Record<string, string>>(`/settings/${key}`, {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify({ value }),
|
||||
}),
|
||||
}
|
||||
|
||||
@@ -51,7 +51,8 @@ export type WsHandler = (msg: WsMessage) => void
|
||||
|
||||
export function connectWs(projectId: string, onMessage: WsHandler): { close: () => void } {
|
||||
const proto = location.protocol === 'https:' ? 'wss:' : 'ws:'
|
||||
const url = `${proto}//${location.host}/ws/${projectId}`
|
||||
const wsBase = import.meta.env.BASE_URL.replace(/\/$/, '')
|
||||
const url = `${proto}//${location.host}/ws${wsBase}/${projectId}`
|
||||
let ws: WebSocket | null = null
|
||||
let reconnectTimer: ReturnType<typeof setTimeout> | null = null
|
||||
let closed = false
|
||||
|
||||
Reference in New Issue
Block a user