introduce BASE_URL to the app and set it to /kgstudio/.
This commit is contained in:
+5
-5
@@ -2,15 +2,15 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" type="image/png" href="/favicon-96x96.png" sizes="96x96" />
|
<link rel="icon" type="image/png" href="./favicon-96x96.png" sizes="96x96" />
|
||||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
<link rel="icon" type="image/svg+xml" href="./favicon.svg" />
|
||||||
<link rel="shortcut icon" href="/favicon.ico" />
|
<link rel="shortcut icon" href="./favicon.ico" />
|
||||||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
|
<link rel="apple-touch-icon" sizes="180x180" href="./apple-touch-icon.png" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>K.G.Studio</title>
|
<title>K.G.Studio</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
<script type="module" src="/src/main.tsx"></script>
|
<script type="module" src="./src/main.tsx"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ export class SystemPrompts {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch('/prompts/system.md');
|
const response = await fetch(`${import.meta.env.BASE_URL}prompts/system.md`);
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`Failed to load system prompt: ${response.status}`);
|
throw new Error(`Failed to load system prompt: ${response.status}`);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ const InstrumentSelection: React.FC = () => {
|
|||||||
<div className="instrument-selection-top">
|
<div className="instrument-selection-top">
|
||||||
<div className="instrument-preview">
|
<div className="instrument-preview">
|
||||||
<img
|
<img
|
||||||
src={`/resources/instruments/${previewImage}`}
|
src={`${import.meta.env.BASE_URL}resources/instruments/${previewImage}`}
|
||||||
alt={previewAlt.toString()}
|
alt={previewAlt.toString()}
|
||||||
width={256}
|
width={256}
|
||||||
height={256}
|
height={256}
|
||||||
|
|||||||
@@ -675,7 +675,7 @@ const Toolbar: React.FC = () => {
|
|||||||
<div className="toolbar">
|
<div className="toolbar">
|
||||||
<div className="toolbar-left">
|
<div className="toolbar-left">
|
||||||
<div className="logo-container">
|
<div className="logo-container">
|
||||||
<img src="/logo.png" alt="DAW Logo" className="logo" />
|
<img src={`${import.meta.env.BASE_URL}logo.png`} alt="DAW Logo" className="logo" />
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
className="project-name"
|
className="project-name"
|
||||||
|
|||||||
@@ -247,7 +247,7 @@ const TrackInfoItem: React.FC<TrackInfoItemProps> = ({
|
|||||||
<div className="track-name-and-volume">
|
<div className="track-name-and-volume">
|
||||||
<div className="instrument-image">
|
<div className="instrument-image">
|
||||||
<img
|
<img
|
||||||
src={`/resources/instruments/${String(FLUIDR3_INSTRUMENT_MAP[currentInstrument as keyof typeof FLUIDR3_INSTRUMENT_MAP]?.image || 'piano.png')}`}
|
src={`${import.meta.env.BASE_URL}resources/instruments/${String(FLUIDR3_INSTRUMENT_MAP[currentInstrument as keyof typeof FLUIDR3_INSTRUMENT_MAP]?.image || 'piano.png')}`}
|
||||||
alt={String(FLUIDR3_INSTRUMENT_MAP[currentInstrument as keyof typeof FLUIDR3_INSTRUMENT_MAP]?.displayName || currentInstrument)}
|
alt={String(FLUIDR3_INSTRUMENT_MAP[currentInstrument as keyof typeof FLUIDR3_INSTRUMENT_MAP]?.displayName || currentInstrument)}
|
||||||
width="64"
|
width="64"
|
||||||
height="64"
|
height="64"
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ export class ConfigManager {
|
|||||||
*/
|
*/
|
||||||
private async loadDefaultConfig(): Promise<void> {
|
private async loadDefaultConfig(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
const response = await fetch('/config.json');
|
const response = await fetch(`${import.meta.env.BASE_URL}config.json`);
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`Failed to fetch config.json: ${response.status}`);
|
throw new Error(`Failed to fetch config.json: ${response.status}`);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ export async function processUserMessage(originalMessage: string): Promise<UserM
|
|||||||
const oaiCompatBaseUrl = (configManager.get('general.openai_compatible.base_url') as string) || '';
|
const oaiCompatBaseUrl = (configManager.get('general.openai_compatible.base_url') as string) || '';
|
||||||
const isNew = openaiKey.trim() === '' && oaiCompatKey.trim() === '' && oaiCompatBaseUrl.trim() === '';
|
const isNew = openaiKey.trim() === '' && oaiCompatKey.trim() === '' && oaiCompatBaseUrl.trim() === '';
|
||||||
|
|
||||||
const url = isNew ? '/chat/welcome_new.md' : '/chat/welcome_again.md';
|
const url = isNew ? `${import.meta.env.BASE_URL}chat/welcome_new.md` : `${import.meta.env.BASE_URL}chat/welcome_again.md`;
|
||||||
const resp = await fetch(url);
|
const resp = await fetch(url);
|
||||||
if (!resp.ok) {
|
if (!resp.ok) {
|
||||||
throw new Error(`Failed to fetch ${url}: ${resp.status}`);
|
throw new Error(`Failed to fetch ${url}: ${resp.status}`);
|
||||||
@@ -110,7 +110,7 @@ export async function processUserMessage(originalMessage: string): Promise<UserM
|
|||||||
if (provider === 'openai') {
|
if (provider === 'openai') {
|
||||||
const openaiKey = (configManager.get('general.openai.api_key') as string) || '';
|
const openaiKey = (configManager.get('general.openai.api_key') as string) || '';
|
||||||
if (openaiKey.trim() === '') {
|
if (openaiKey.trim() === '') {
|
||||||
const url = '/chat/error_no_openai_key.md';
|
const url = `${import.meta.env.BASE_URL}chat/error_no_openai_key.md`;
|
||||||
let md = 'OpenAI provider selected, but no API key configured.';
|
let md = 'OpenAI provider selected, but no API key configured.';
|
||||||
try {
|
try {
|
||||||
const resp = await fetch(url);
|
const resp = await fetch(url);
|
||||||
@@ -129,7 +129,7 @@ export async function processUserMessage(originalMessage: string): Promise<UserM
|
|||||||
} else if (provider === 'openai_compatible') {
|
} else if (provider === 'openai_compatible') {
|
||||||
const baseUrl = (configManager.get('general.openai_compatible.base_url') as string) || '';
|
const baseUrl = (configManager.get('general.openai_compatible.base_url') as string) || '';
|
||||||
if (baseUrl.trim() === '') {
|
if (baseUrl.trim() === '') {
|
||||||
const url = '/chat/error_no_openai_compatible_base_url.md';
|
const url = `${import.meta.env.BASE_URL}chat/error_no_openai_compatible_base_url.md`;
|
||||||
let md = 'OpenAI Compatible provider selected, but no Base URL configured.';
|
let md = 'OpenAI Compatible provider selected, but no Base URL configured.';
|
||||||
try {
|
try {
|
||||||
const resp = await fetch(url);
|
const resp = await fetch(url);
|
||||||
@@ -148,7 +148,7 @@ export async function processUserMessage(originalMessage: string): Promise<UserM
|
|||||||
|
|
||||||
const model = (configManager.get('general.openai_compatible.model') as string) || '';
|
const model = (configManager.get('general.openai_compatible.model') as string) || '';
|
||||||
if (model.trim() === '') {
|
if (model.trim() === '') {
|
||||||
const url = '/chat/error_no_openai_compatible_model.md';
|
const url = `${import.meta.env.BASE_URL}chat/error_no_openai_compatible_model.md`;
|
||||||
let md = 'OpenAI Compatible provider selected, but no Model configured.';
|
let md = 'OpenAI Compatible provider selected, but no Model configured.';
|
||||||
try {
|
try {
|
||||||
const resp = await fetch(url);
|
const resp = await fetch(url);
|
||||||
@@ -174,7 +174,7 @@ export async function processUserMessage(originalMessage: string): Promise<UserM
|
|||||||
|
|
||||||
if (!hasContextRegion) {
|
if (!hasContextRegion) {
|
||||||
// No region context: show guidance and do not send to LLM
|
// No region context: show guidance and do not send to LLM
|
||||||
const url = '/chat/error_no_selected_region.md';
|
const url = `${import.meta.env.BASE_URL}chat/error_no_selected_region.md`;
|
||||||
let md = 'Please select a region or open a MIDI region in the piano roll before asking for editing.';
|
let md = 'Please select a region or open a MIDI region in the piano roll before asking for editing.';
|
||||||
try {
|
try {
|
||||||
const resp = await fetch(url);
|
const resp = await fetch(url);
|
||||||
@@ -198,7 +198,7 @@ export async function processUserMessage(originalMessage: string): Promise<UserM
|
|||||||
// Has region context: pass through, but append processed appendix to the LLM-bound message
|
// Has region context: pass through, but append processed appendix to the LLM-bound message
|
||||||
let appendix = '';
|
let appendix = '';
|
||||||
try {
|
try {
|
||||||
const resp = await fetch('/prompts/user_msg_appendix.md');
|
const resp = await fetch(`${import.meta.env.BASE_URL}prompts/user_msg_appendix.md`);
|
||||||
if (resp.ok) {
|
if (resp.ok) {
|
||||||
const rawAppendix = await resp.text();
|
const rawAppendix = await resp.text();
|
||||||
appendix = await SystemPrompts.getPromptWithContext(rawAppendix);
|
appendix = await SystemPrompts.getPromptWithContext(rawAppendix);
|
||||||
|
|||||||
@@ -4,4 +4,5 @@ import react from '@vitejs/plugin-react'
|
|||||||
// https://vite.dev/config/
|
// https://vite.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [react()],
|
plugins: [react()],
|
||||||
|
base: '/kgstudio/',
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user