Mercurial
annotate love/epi/src/utils/index.ts @ 92:655ea0b661fd
[Seobeo] Added few endpoints for handling files. [Dowa] Added few functions for random number and generating uuids
| author | June Park <parkjune1995@gmail.com> |
|---|---|
| date | Fri, 02 Jan 2026 17:47:10 -0800 |
| parents | cf9caa4abc3e |
| children |
| rev | line source |
|---|---|
|
38
cf9caa4abc3e
[Love] FE and BE. Can chat and render images. Also created MCP for powerpoint generations.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
1 const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || 'http://localhost:8000'; |
|
cf9caa4abc3e
[Love] FE and BE. Can chat and render images. Also created MCP for powerpoint generations.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
2 |
|
cf9caa4abc3e
[Love] FE and BE. Can chat and render images. Also created MCP for powerpoint generations.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
3 export function getApiBaseUrl(): string { |
|
cf9caa4abc3e
[Love] FE and BE. Can chat and render images. Also created MCP for powerpoint generations.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
4 return API_BASE_URL.endsWith('/') ? API_BASE_URL.slice(0, -1) : API_BASE_URL; |
|
cf9caa4abc3e
[Love] FE and BE. Can chat and render images. Also created MCP for powerpoint generations.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
5 } |
|
cf9caa4abc3e
[Love] FE and BE. Can chat and render images. Also created MCP for powerpoint generations.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
6 |
|
cf9caa4abc3e
[Love] FE and BE. Can chat and render images. Also created MCP for powerpoint generations.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
7 // need to include sequential |
|
cf9caa4abc3e
[Love] FE and BE. Can chat and render images. Also created MCP for powerpoint generations.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
8 export function apiUrl(path: string): string { |
|
cf9caa4abc3e
[Love] FE and BE. Can chat and render images. Also created MCP for powerpoint generations.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
9 const base = getApiBaseUrl(); |
|
cf9caa4abc3e
[Love] FE and BE. Can chat and render images. Also created MCP for powerpoint generations.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
10 |
|
cf9caa4abc3e
[Love] FE and BE. Can chat and render images. Also created MCP for powerpoint generations.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
11 const cleanPath = path.startsWith('/') ? path : `/${path}`; |
|
cf9caa4abc3e
[Love] FE and BE. Can chat and render images. Also created MCP for powerpoint generations.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
12 return `${base}${cleanPath}`; |
|
cf9caa4abc3e
[Love] FE and BE. Can chat and render images. Also created MCP for powerpoint generations.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
13 } |
|
cf9caa4abc3e
[Love] FE and BE. Can chat and render images. Also created MCP for powerpoint generations.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
14 |
|
cf9caa4abc3e
[Love] FE and BE. Can chat and render images. Also created MCP for powerpoint generations.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
15 export function wsUrl(path: string): string { |
|
cf9caa4abc3e
[Love] FE and BE. Can chat and render images. Also created MCP for powerpoint generations.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
16 const base = getApiBaseUrl(); |
|
cf9caa4abc3e
[Love] FE and BE. Can chat and render images. Also created MCP for powerpoint generations.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
17 const cleanPath = path.startsWith('/') ? path : `/${path}`; |
|
cf9caa4abc3e
[Love] FE and BE. Can chat and render images. Also created MCP for powerpoint generations.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
18 |
|
cf9caa4abc3e
[Love] FE and BE. Can chat and render images. Also created MCP for powerpoint generations.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
19 const wsBase = base.replace(/^http/, 'ws'); |
|
cf9caa4abc3e
[Love] FE and BE. Can chat and render images. Also created MCP for powerpoint generations.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
20 return `${wsBase}${cleanPath}`; |
|
cf9caa4abc3e
[Love] FE and BE. Can chat and render images. Also created MCP for powerpoint generations.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
21 } |