fix: withAPIBaseURL for all urls
This commit is contained in:
@ -1,4 +1,3 @@
|
|||||||
import { VITE_KC_API_BASE_URL } from '@src/env'
|
|
||||||
import { UAParser } from 'ua-parser-js'
|
import { UAParser } from 'ua-parser-js'
|
||||||
|
|
||||||
import type { OsInfo } from '@rust/kcl-lib/bindings/OsInfo'
|
import type { OsInfo } from '@rust/kcl-lib/bindings/OsInfo'
|
||||||
@ -11,6 +10,7 @@ import { isDesktop } from '@src/lib/isDesktop'
|
|||||||
import type RustContext from '@src/lib/rustContext'
|
import type RustContext from '@src/lib/rustContext'
|
||||||
import screenshot from '@src/lib/screenshot'
|
import screenshot from '@src/lib/screenshot'
|
||||||
import { APP_VERSION } from '@src/routes/utils'
|
import { APP_VERSION } from '@src/routes/utils'
|
||||||
|
import { withAPIBaseURL } from '@src/lib/withBaseURL'
|
||||||
|
|
||||||
/* eslint-disable suggest-no-throw/suggest-no-throw --
|
/* eslint-disable suggest-no-throw/suggest-no-throw --
|
||||||
* All the throws in CoreDumpManager are intentional and should be caught and handled properly
|
* All the throws in CoreDumpManager are intentional and should be caught and handled properly
|
||||||
@ -35,7 +35,7 @@ export class CoreDumpManager {
|
|||||||
codeManager: CodeManager
|
codeManager: CodeManager
|
||||||
rustContext: RustContext
|
rustContext: RustContext
|
||||||
token: string | undefined
|
token: string | undefined
|
||||||
baseUrl: string = VITE_KC_API_BASE_URL
|
baseUrl: string = withAPIBaseURL('')
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
engineCommandManager: EngineCommandManager,
|
engineCommandManager: EngineCommandManager,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import type { SelectionRange } from '@codemirror/state'
|
import type { SelectionRange } from '@codemirror/state'
|
||||||
import { EditorSelection, Transaction } from '@codemirror/state'
|
import { EditorSelection, Transaction } from '@codemirror/state'
|
||||||
import type { Models } from '@kittycad/lib'
|
import type { Models } from '@kittycad/lib'
|
||||||
import { VITE_KC_API_BASE_URL, VITE_KC_SITE_BASE_URL } from '@src/env'
|
import { VITE_KC_SITE_BASE_URL } from '@src/env'
|
||||||
import { diffLines } from 'diff'
|
import { diffLines } from 'diff'
|
||||||
import toast from 'react-hot-toast'
|
import toast from 'react-hot-toast'
|
||||||
import type { TextToCadMultiFileIteration_type } from '@kittycad/lib/dist/types/src/models'
|
import type { TextToCadMultiFileIteration_type } from '@kittycad/lib/dist/types/src/models'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { VITE_KC_API_BASE_URL } from '@src/env'
|
import { withAPIBaseURL } from '@src/lib/withBaseURL'
|
||||||
|
|
||||||
import EditorManager from '@src/editor/manager'
|
import EditorManager from '@src/editor/manager'
|
||||||
import { KclManager } from '@src/lang/KclSingleton'
|
import { KclManager } from '@src/lang/KclSingleton'
|
||||||
@ -171,7 +171,7 @@ const appMachine = setup({
|
|||||||
systemId: BILLING,
|
systemId: BILLING,
|
||||||
input: {
|
input: {
|
||||||
...BILLING_CONTEXT_DEFAULTS,
|
...BILLING_CONTEXT_DEFAULTS,
|
||||||
urlUserService: VITE_KC_API_BASE_URL,
|
urlUserService: withAPIBaseURL(''),
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import type { Models } from '@kittycad/lib'
|
import type { Models } from '@kittycad/lib'
|
||||||
import { VITE_KC_API_BASE_URL } from '@src/env'
|
|
||||||
import toast from 'react-hot-toast'
|
import toast from 'react-hot-toast'
|
||||||
import type { NavigateFunction } from 'react-router-dom'
|
import type { NavigateFunction } from 'react-router-dom'
|
||||||
import {
|
import {
|
||||||
@ -19,6 +18,7 @@ import { err, reportRejection } from '@src/lib/trap'
|
|||||||
import { toSync } from '@src/lib/utils'
|
import { toSync } from '@src/lib/utils'
|
||||||
import { getAllSubDirectoriesAtProjectRoot } from '@src/machines/systemIO/snapshotContext'
|
import { getAllSubDirectoriesAtProjectRoot } from '@src/machines/systemIO/snapshotContext'
|
||||||
import { joinOSPaths } from '@src/lib/paths'
|
import { joinOSPaths } from '@src/lib/paths'
|
||||||
|
import { withAPIBaseURL } from '@src/lib/withBaseURL'
|
||||||
|
|
||||||
export async function submitTextToCadPrompt(
|
export async function submitTextToCadPrompt(
|
||||||
prompt: string,
|
prompt: string,
|
||||||
@ -32,7 +32,7 @@ export async function submitTextToCadPrompt(
|
|||||||
kcl_version: kclManager.kclVersion,
|
kcl_version: kclManager.kclVersion,
|
||||||
}
|
}
|
||||||
// Glb has a smaller footprint than gltf, should we want to render it.
|
// Glb has a smaller footprint than gltf, should we want to render it.
|
||||||
const url = VITE_KC_API_BASE_URL + '/ai/text-to-cad/glb?kcl=true'
|
const url = withAPIBaseURL('/ai/text-to-cad/glb?kcl=true')
|
||||||
const data: Models['TextToCad_type'] | Error = await crossPlatformFetch(
|
const data: Models['TextToCad_type'] | Error = await crossPlatformFetch(
|
||||||
url,
|
url,
|
||||||
{
|
{
|
||||||
@ -58,7 +58,7 @@ export async function getTextToCadResult(
|
|||||||
id: string,
|
id: string,
|
||||||
token?: string
|
token?: string
|
||||||
): Promise<Models['TextToCad_type'] | Error> {
|
): Promise<Models['TextToCad_type'] | Error> {
|
||||||
const url = VITE_KC_API_BASE_URL + '/user/text-to-cad/' + id
|
const url = withAPIBaseURL(`/user/text-to-cad/${id}`)
|
||||||
const data: Models['TextToCad_type'] | Error = await crossPlatformFetch(
|
const data: Models['TextToCad_type'] | Error = await crossPlatformFetch(
|
||||||
url,
|
url,
|
||||||
{
|
{
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
import type { Models } from '@kittycad/lib/dist/types/src'
|
import type { Models } from '@kittycad/lib/dist/types/src'
|
||||||
import { VITE_KC_API_BASE_URL } from '@src/env'
|
|
||||||
import crossPlatformFetch from '@src/lib/crossPlatformFetch'
|
import crossPlatformFetch from '@src/lib/crossPlatformFetch'
|
||||||
|
import { withAPIBaseURL } from '@src/lib/withBaseURL'
|
||||||
|
|
||||||
export async function sendTelemetry(
|
export async function sendTelemetry(
|
||||||
id: string,
|
id: string,
|
||||||
feedback: Models['MlFeedback_type'],
|
feedback: Models['MlFeedback_type'],
|
||||||
token?: string
|
token?: string
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const url =
|
const url = withAPIBaseURL(`/user/text-to-cad/${id}/?feedback=${feedback}`)
|
||||||
VITE_KC_API_BASE_URL + '/user/text-to-cad/' + id + '?feedback=' + feedback
|
|
||||||
await crossPlatformFetch(
|
await crossPlatformFetch(
|
||||||
url,
|
url,
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user