Skip to content

Commit 02b58e7

Browse files
Release 0.1.1 (#5)
* Update the use effect for darkmode in authcallback * Update readme * Update ci to run on dev branch * chore: update built files * Fix token refresh issue (#4) ---------
1 parent b3a0d84 commit 02b58e7

File tree

15 files changed

+196
-188
lines changed

15 files changed

+196
-188
lines changed

.github/workflows/commit_build_files_push.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- main
7+
- dev
78
workflow_dispatch:
89

910
permissions:

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Run this in the root of the project to build the wheel package:
4646
python -m build -w
4747
```
4848

49-
This will create a /dist folder containing the wheel file which needs to be installed as a dependency in the ai-eda-solace-chat project.
49+
This will create a /dist folder containing the wheel file which needs to be installed as a dependency in the solace-agent-mesh project.
5050

5151
One suggested workflow for installing the wheel:
5252

@@ -100,7 +100,7 @@ WEBUI_FRONTEND_USE_AUTHORIZATION=False
100100
WEBUI_FRONTEND_URL=http://localhost:5173
101101
```
102102

103-
This configuration allows you to use `npm run dev` while still connecting to the server run by EDA chat.
103+
This configuration allows you to use `npm run dev` while still connecting to the REST API run by Solace Agent Mesh.
104104

105105
## Notes
106106

src/solace_ai_connector_web/backend/server.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,9 @@ def handle_chat_response(self):
306306
response.raise_for_status()
307307
except Exception:
308308
return {"error": "Unauthorized"}, 401
309-
return {"error": "Failed to get response"}, 500
309+
# Only return 500 if both the original request and the token refresh attempt failed
310+
if response.status_code != 200:
311+
return {"error": "Failed to get response"}, 500
310312

311313
return Response(
312314
self._create_stream_response(response, new_access_token_formatted),

src/solace_ai_connector_web/frontend/app/routes/auth-callback.tsx

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@ export default function AuthCallback() {
1010
const { configServerUrl } = useConfig();
1111

1212
useEffect(() => {
13-
// Check if dark mode is enabled
14-
const isDark = document.documentElement.classList.contains('dark') ||
15-
localStorage.getItem('theme') === 'dark' ||
16-
(!localStorage.getItem('theme') && window.matchMedia('(prefers-color-scheme: dark)').matches);
13+
const hasDarkClass = document.documentElement.classList.contains('dark');
14+
const storedPreference = localStorage.getItem('darkMode') === 'true';
15+
const prefersDarkScheme = window.matchMedia('(prefers-color-scheme: dark)').matches;
16+
const useSystemPreference = !localStorage.getItem('darkMode') && prefersDarkScheme;
17+
18+
// Set dark mode if any of the conditions are true
19+
const isDark = hasDarkClass || storedPreference || useSystemPreference;
1720
setIsDarkMode(isDark);
1821
}, []);
1922

@@ -54,15 +57,15 @@ export default function AuthCallback() {
5457
if (error) {
5558
return (
5659
<div className="text-red-500">
57-
<h2 className={isDarkMode ? "text-white" : "text-black"}>Error</h2>
58-
<p className={isDarkMode ? "text-red-400" : "text-red-500"}>{error}</p>
60+
<h2 className="text-black dark:text-white">Error</h2>
61+
<p className="text-red-500 dark:text-red-400">{error}</p>
5962
</div>
6063
);
6164
}
6265
if (token) {
6366
return (
6467
<div className="space-y-4">
65-
<h2 className={`text-2xl ${isDarkMode ? "text-white" : "text-black"}`}>Successfully Authenticated!</h2>
68+
<h2 className="text-2xl text-black dark:text-white">Successfully Authenticated!</h2>
6669
<button
6770
onClick={() => window.location.href = '/'}
6871
className="bg-solace-green text-white px-6 py-2 rounded shadow hover:bg-solace-dark-green"
@@ -72,13 +75,15 @@ export default function AuthCallback() {
7275
</div>
7376
);
7477
}
75-
return <div className={isDarkMode ? "text-white" : "text-black"}>Processing authentication...</div>;
78+
return <div className="text-black dark:text-white">Processing authentication...</div>;
7679
};
7780

7881
return (
79-
<div className={`min-h-screen flex items-center justify-center ${isDarkMode ? "bg-gray-900" : "bg-white"}`}>
80-
<div className="text-center p-8 max-w-lg">
81-
{renderContent()}
82+
<div className={`${isDarkMode ? "dark" : ""} min-h-screen flex items-center justify-center`}>
83+
<div className="min-h-screen w-full flex items-center justify-center bg-white dark:bg-gray-900">
84+
<div className="text-center p-8 max-w-lg">
85+
{renderContent()}
86+
</div>
8287
</div>
8388
</div>
8489
);

src/solace_ai_connector_web/frontend/static/client/assets/auth-callback-DxxGoGXk.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/solace_ai_connector_web/frontend/static/client/assets/auth-callback-WqaqyEYc.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)