fix: allow local Gemma runtime on GitHub Pages and avoid OPFS cache finalize read errors

This commit is contained in:
Xiaohan-Tian
2026-05-15 13:04:36 -07:00
parent b2bbc08761
commit e243f9e2ca
5 changed files with 23 additions and 47 deletions
-6
View File
@@ -341,7 +341,6 @@ const ChatBox: React.FC<ChatBoxProps> = ({ isVisible }) => {
const localRuntimeMessage = localModelState.runtimeSupport.reason;
const hasLocalRuntimeHardFailure = !localModelState.runtimeSupport.supported;
const hasLocalRuntimeWarning = localModelState.runtimeSupport.supported && !!localRuntimeMessage;
return (
<div className={`chatbox ${isVisible ? '' : 'is-hidden'}`}>
@@ -395,11 +394,6 @@ const ChatBox: React.FC<ChatBoxProps> = ({ isVisible }) => {
<div className="chatbox-local-runtime-section">
<div className="chatbox-local-runtime-card">
<h4 className="chatbox-local-mode-title">{LOCAL_LLM_DISPLAY_NAME} Local Runtime</h4>
{hasLocalRuntimeWarning && (
<div className="chatbox-local-runtime-warning">
{localRuntimeMessage}
</div>
)}
{hasLocalRuntimeHardFailure && (
<div className="chatbox-local-runtime-error">
{localRuntimeMessage}
@@ -119,7 +119,7 @@ describe('GeneralSettings', () => {
});
});
it('shows a warning when runtime may fail on this host but is still allowed', async () => {
it('keeps local runtime available when runtime may fail on this host', async () => {
localModelState.runtimeSupport = {
supported: true,
webgpuExposed: true,
@@ -131,7 +131,8 @@ describe('GeneralSettings', () => {
render(<GeneralSettings />);
expect(await screen.findByText(/may not support the local browser runtime reliably/i)).toBeTruthy();
expect(await screen.findByText('Gemma 4 E4B Local Runtime')).toBeTruthy();
expect(screen.queryByText(/may not support the local browser runtime reliably/i)).toBeNull();
expect(screen.getByText(/The local model downloads automatically/i)).toBeTruthy();
});
});
@@ -234,7 +234,6 @@ const GeneralSettings: React.FC = () => {
const localRuntimeMessage = localModelState.runtimeSupport.reason;
const hasLocalRuntimeHardFailure = !localModelState.runtimeSupport.supported;
const hasLocalRuntimeWarning = localModelState.runtimeSupport.supported && !!localRuntimeMessage;
// NOTE: Gemini and Claude are not supported yet due to CORS issues.
return (
@@ -286,12 +285,6 @@ const GeneralSettings: React.FC = () => {
<div className="settings-group">
<h4>{LOCAL_LLM_DISPLAY_NAME} Local Runtime</h4>
{hasLocalRuntimeWarning && (
<div className="settings-help" style={{ fontSize: '12px', color: '#d0a56b', marginTop: '4px', marginBottom: '8px' }}>
{localRuntimeMessage}
</div>
)}
{hasLocalRuntimeHardFailure && (
<div className="settings-help" style={{ fontSize: '12px', color: '#d45a5a', marginTop: '4px', marginBottom: '8px' }}>
{localRuntimeMessage}