Skip to content

Commit f8e0705

Browse files
committed
wip
1 parent 8890ecf commit f8e0705

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+9451
-38
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Gradle Releases -> https://github.com/gradle/gradle/releases
22
libraryGroup=com.simiacryptus.skyenet
3-
libraryVersion=1.2.21
3+
libraryVersion=1.2.22
44
gradleVersion=7.6.1
55
kotlin.daemon.jvmargs=-Xmx4g

webapp/src/components/Menu/Menu.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export const Menu: React.FC = () => {
148148
</DropButton>
149149
<DropdownContent>
150150
<DropdownItem onClick={() => handleMenuClick('settings')}>Settings</DropdownItem>
151-
<DropdownItem onClick={() => handleMenuClick('files')}>Files</DropdownItem>
151+
<DropdownItem onClick={() => handleMenuClick('fileIndex/')}>Files</DropdownItem>
152152
<DropdownItem onClick={() => handleMenuClick('usage')}>Usage</DropdownItem>
153153
<DropdownItem onClick={() => handleMenuClick('threads')}>Threads</DropdownItem>
154154
<DropdownItem onClick={() => handleMenuClick('share')}>Share</DropdownItem>
@@ -165,8 +165,8 @@ export const Menu: React.FC = () => {
165165
<Dropdown>
166166
<DropButton onClick={() => console.log('[Menu] About menu clicked')}>About</DropButton>
167167
<DropdownContent>
168-
<DropdownItem onClick={() => handleMenuClick('privacy')}>Privacy Policy</DropdownItem>
169-
<DropdownItem onClick={() => handleMenuClick('tos')}>Terms of Service</DropdownItem>
168+
<DropdownItem onClick={() => handleMenuClick('/privacy.html')}>Privacy Policy</DropdownItem>
169+
<DropdownItem onClick={() => handleMenuClick('/tos.html')}>Terms of Service</DropdownItem>
170170
</DropdownContent>
171171
</Dropdown>
172172

webapp/src/components/Modal/Modal.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import React, {useEffect} from 'react';
1+
import React from 'react';
22
import styled from 'styled-components';
33
import {useDispatch, useSelector} from 'react-redux';
44
import {RootState} from '../../store';
55
import {hideModal} from '../../store/slices/uiSlice';
6-
import {useModal} from '../../hooks/useModal';
6+
import {useEffect} from 'react';
77

88
const ModalOverlay = styled.div`
99
position: fixed;
@@ -25,21 +25,22 @@ const ModalContent = styled.div`
2525
min-width: 300px;
2626
max-width: 80vw;
2727
max-height: 80vh;
28+
min-height: 200px;
2829
overflow: auto;
2930
`;
3031
const LOG_PREFIX = '[Modal]';
3132

3233

3334
export const Modal: React.FC = () => {
3435
const dispatch = useDispatch();
35-
const {modalContent} = useModal();
36-
const {modalOpen, modalType} = useSelector((state: RootState) => state.ui);
36+
const {modalOpen, modalType, modalContent} = useSelector((state: RootState) => state.ui);
3737

3838
useEffect(() => {
3939
console.log(`${LOG_PREFIX} Modal state changed:`, {
4040
modalOpen,
4141
modalType,
42-
hasContent: !!modalContent
42+
hasContent: !!modalContent,
43+
contentLength: modalContent?.length || 0
4344
});
4445
}, [modalOpen, modalType, modalContent]);
4546

@@ -50,9 +51,9 @@ export const Modal: React.FC = () => {
5051

5152
return (
5253
<ModalOverlay onClick={() => dispatch(hideModal())}>
53-
<ModalContent onClick={e => e.stopPropagation()}>
54+
<ModalContent className="modal-content" onClick={e => e.stopPropagation()}>
5455
<h2>{modalType}</h2>
55-
<div dangerouslySetInnerHTML={{__html: modalContent}}/>
56+
<div dangerouslySetInnerHTML={{__html: modalContent || ''}}/>
5657
</ModalContent>
5758
</ModalOverlay>
5859
);

webapp/src/hooks/useModal.ts

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import {useDispatch} from 'react-redux';
22
import WebSocketService from '../services/websocket';
3-
import {showModal as showModalAction} from '../store/slices/uiSlice';
4-
import {useState} from "react";
3+
import {setModalContent, showModal as showModalAction} from '../store/slices/uiSlice';
54
import Prism from 'prismjs';
65

76
export const useModal = () => {
87
const dispatch = useDispatch();
9-
const [modalContent, setModalContent] = useState('');
108

119
// Helper to highlight code blocks
1210
const highlightCode = () => {
@@ -25,9 +23,19 @@ export const useModal = () => {
2523
const protocol = window.location.protocol;
2624
const host = window.location.hostname;
2725
const port = window.location.port;
28-
// Handle endpoints that already have query parameters
29-
const separator = endpoint.includes('?') ? '&' : '?';
30-
const url = `${protocol}//${host}:${port}/${endpoint}${separator}sessionId=${WebSocketService.getSessionId()}`;
26+
const path = window.location.pathname;
27+
let url: string;
28+
if (endpoint.startsWith("/")) {
29+
url = `${protocol}//${host}:${port}${endpoint}`;
30+
} else {
31+
url = `${protocol}//${host}:${port}${path}${endpoint}`;
32+
}
33+
if (endpoint.endsWith("/")) {
34+
url = url + WebSocketService.getSessionId() + '/';
35+
} else {
36+
const separator = endpoint.includes('?') ? '&' : '?';
37+
url = url + separator + 'sessionId=' + WebSocketService.getSessionId();
38+
}
3139
console.log('[Modal] Constructed URL:', url);
3240
return url;
3341
};
@@ -41,44 +49,44 @@ export const useModal = () => {
4149
}
4250
console.log('[Modal] Setting initial loading state');
4351

44-
setModalContent('<div>Loading...</div>');
4552
dispatch(showModalAction(endpoint));
53+
dispatch(setModalContent('<div class="loading">Loading...</div>'));
4654
console.log('[Modal] Fetching content from:', getModalUrl(endpoint));
4755

4856
fetch(getModalUrl(endpoint), {
4957
mode: 'cors',
58+
credentials: 'include',
5059
headers: {
51-
'Accept': 'text/html,application/json',
52-
credentials: 'include'
60+
'Accept': 'text/html,application/json,*/*'
5361
}
5462
})
5563
.then(response => {
5664
console.log('[Modal] Received response:', {
5765
status: response.status,
5866
statusText: response.statusText
5967
});
68+
if (!response.ok) {
69+
throw new Error(`HTTP error! status: ${response.status}`);
70+
}
6071
return response.text();
6172
})
6273
.then(content => {
6374
console.log('[Modal] Content received, length:', content.length);
64-
setModalContent(content);
65-
// Highlight code after content is set
75+
if (!content.trim()) {
76+
throw new Error('Received empty content');
77+
}
6678
requestAnimationFrame(() => {
79+
dispatch(setModalContent(content));
6780
highlightCode();
6881
});
6982
})
7083
.catch(error => {
71-
console.error('[Modal] Failed to load content:', {
72-
endpoint,
73-
error: error.message,
74-
status: error.status,
75-
stack: error.stack
76-
});
77-
setModalContent('<div>Error loading content. Please try again later.</div>');
84+
console.error('[Modal] Failed to load content:', error);
85+
dispatch(setModalContent('<div class="error">Error loading content: ' + error.message + '</div>'));
7886
// Keep modal open to show error
7987
});
8088
};
8189
console.log('[Modal] Hook initialized');
8290

83-
return {openModal, getModalUrl, modalContent};
91+
return {openModal, getModalUrl};
8492
};

webapp/src/services/appConfig.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {ThemeName} from '../types';
55

66
const LOG_PREFIX = '[AppConfig]';
77

8-
const BASE_API_URL = process.env.REACT_APP_API_URL || window.location.origin;
8+
const BASE_API_URL = process.env.REACT_APP_API_URL || (window.location.origin + window.location.pathname);
99
const STORAGE_KEYS = {
1010
THEME: 'theme',
1111
} as const;
@@ -70,7 +70,7 @@ export const fetchAppConfig = async (sessionId: string) => {
7070
baseUrl: BASE_API_URL
7171
});
7272

73-
const url = new URL('/appInfo', BASE_API_URL);
73+
const url = new URL('./appInfo', BASE_API_URL);
7474
url.searchParams.append('session', sessionId);
7575

7676
let response: Response;

webapp/src/store/slices/uiSlice.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ interface UiState {
4949
theme: ThemeName;
5050
modalOpen: boolean;
5151
modalType: string | null;
52+
modalContent: string;
5253
verboseMode: boolean;
5354
activeTab: string;
5455
lastUpdate?: number;
@@ -58,6 +59,7 @@ const initialState: UiState = {
5859
theme: 'main',
5960
modalOpen: false,
6061
modalType: null,
62+
modalContent: '',
6163
verboseMode: safeStorage.setItem('verboseMode', 'false') ? false : false,
6264
activeTab: 'chat', // Set default tab
6365
lastUpdate: Date.now()
@@ -71,7 +73,7 @@ const logStateChange = (action: string, payload: any = null, prevState: any = nu
7173
});
7274
};
7375

74-
const uiSlice = createSlice({
76+
export const uiSlice = createSlice({
7577
name: 'ui',
7678
initialState,
7779
reducers: {
@@ -102,6 +104,7 @@ const uiSlice = createSlice({
102104
});
103105
state.modalOpen = true;
104106
state.modalType = action.payload;
107+
state.modalContent = 'Loading...';
105108
},
106109
hideModal: (state) => {
107110
logStateChange('Hiding modal', null, {
@@ -110,7 +113,11 @@ const uiSlice = createSlice({
110113
});
111114
state.modalOpen = false;
112115
state.modalType = null;
116+
state.modalContent = '';
113117
},
118+
setModalContent: (state, action) => {
119+
state.modalContent = action.payload;
120+
},
114121
toggleVerbose: (state) => {
115122
const newVerboseState = !state.verboseMode;
116123
logStateChange('Toggling verbose mode', {
@@ -124,7 +131,7 @@ const uiSlice = createSlice({
124131
},
125132
});
126133

127-
export const {setTheme, showModal, hideModal, toggleVerbose, setActiveTab} = uiSlice.actions;
134+
export const {setTheme, showModal, hideModal, toggleVerbose, setActiveTab, setModalContent} = uiSlice.actions;
128135
logStateChange('Initialized slice', null, null, initialState);
129136

130137
export default uiSlice.reducer;

webui/src/main/resources/application/asset-manifest.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"files": {
33
"main.css": "/static/css/main.32ca5a31.css",
4-
"main.js": "/static/js/main.efe59532.js",
4+
"main.js": "/static/js/main.45e62201.js",
55
"static/js/9017.98ad007d.chunk.js": "/static/js/9017.98ad007d.chunk.js",
66
"static/js/5536.9c75127e.chunk.js": "/static/js/5536.9c75127e.chunk.js",
77
"static/js/7035.2bce51c5.chunk.js": "/static/js/7035.2bce51c5.chunk.js",
@@ -73,7 +73,7 @@
7373
"static/js/5195.756798f5.chunk.js": "/static/js/5195.756798f5.chunk.js",
7474
"index.html": "/index.html",
7575
"main.32ca5a31.css.map": "/static/css/main.32ca5a31.css.map",
76-
"main.efe59532.js.map": "/static/js/main.efe59532.js.map",
76+
"main.45e62201.js.map": "/static/js/main.45e62201.js.map",
7777
"9017.98ad007d.chunk.js.map": "/static/js/9017.98ad007d.chunk.js.map",
7878
"5536.9c75127e.chunk.js.map": "/static/js/5536.9c75127e.chunk.js.map",
7979
"7035.2bce51c5.chunk.js.map": "/static/js/7035.2bce51c5.chunk.js.map",
@@ -141,6 +141,6 @@
141141
},
142142
"entrypoints": [
143143
"static/css/main.32ca5a31.css",
144-
"static/js/main.efe59532.js"
144+
"static/js/main.45e62201.js"
145145
]
146146
}
Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,19 @@
1-
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>React App</title><script defer="defer" src="/static/js/main.efe59532.js"></script><link href="/static/css/main.32ca5a31.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8"/>
5+
<link rel="icon" href="favicon.ico"/>
6+
<meta name="viewport" content="width=device-width,initial-scale=1"/>
7+
<meta name="theme-color" content="#000000"/>
8+
<meta name="description" content="Web site created using create-react-app"/>
9+
<link rel="apple-touch-icon" href="logo192.png"/>
10+
<link rel="manifest" href="manifest.json"/>
11+
<title>React App</title>
12+
<script defer="defer" src="static/js/main.45e62201.js"></script>
13+
<link href="static/css/main.32ca5a31.css" rel="stylesheet">
14+
</head>
15+
<body>
16+
<noscript>You need to enable JavaScript to run this app.</noscript>
17+
<div id="root"></div>
18+
</body>
19+
</html>

webui/src/main/resources/application/static/js/main.1331d5d1.js

Lines changed: 649 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/*!
2+
* Font Awesome Free 6.7.1 by @fontawesome - https://fontawesome.com
3+
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
4+
* Copyright 2024 Fonticons, Inc.
5+
*/
6+
7+
/*! @license DOMPurify 3.2.2 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.2/LICENSE */
8+
9+
/*! Bundled license information:
10+
11+
js-yaml/dist/js-yaml.mjs:
12+
(*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT *)
13+
*/
14+
15+
/**
16+
* @license React
17+
* react-dom.production.min.js
18+
*
19+
* Copyright (c) Facebook, Inc. and its affiliates.
20+
*
21+
* This source code is licensed under the MIT license found in the
22+
* LICENSE file in the root directory of this source tree.
23+
*/
24+
25+
/**
26+
* @license React
27+
* react-jsx-runtime.production.min.js
28+
*
29+
* Copyright (c) Facebook, Inc. and its affiliates.
30+
*
31+
* This source code is licensed under the MIT license found in the
32+
* LICENSE file in the root directory of this source tree.
33+
*/
34+
35+
/**
36+
* @license React
37+
* react.production.min.js
38+
*
39+
* Copyright (c) Facebook, Inc. and its affiliates.
40+
*
41+
* This source code is licensed under the MIT license found in the
42+
* LICENSE file in the root directory of this source tree.
43+
*/
44+
45+
/**
46+
* @license React
47+
* scheduler.production.min.js
48+
*
49+
* Copyright (c) Facebook, Inc. and its affiliates.
50+
*
51+
* This source code is licensed under the MIT license found in the
52+
* LICENSE file in the root directory of this source tree.
53+
*/
54+
55+
/**
56+
* @license React
57+
* use-sync-external-store-with-selector.production.min.js
58+
*
59+
* Copyright (c) Facebook, Inc. and its affiliates.
60+
*
61+
* This source code is licensed under the MIT license found in the
62+
* LICENSE file in the root directory of this source tree.
63+
*/
64+
65+
/**
66+
* Prism: Lightweight, robust, elegant syntax highlighting
67+
*
68+
* @license MIT <https://opensource.org/licenses/MIT>
69+
* @author Lea Verou <https://lea.verou.me>
70+
* @namespace
71+
* @public
72+
*/

0 commit comments

Comments
 (0)