Skip to content

Commit 4f386d2

Browse files
committed
Ollama troubleshooting modal
1 parent c3f11a6 commit 4f386d2

File tree

3 files changed

+227
-21
lines changed

3 files changed

+227
-21
lines changed

DeepResearch.html

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,195 @@
768768
color: rgba(255, 255, 255, 0.7);
769769
}
770770

771+
/* Troubleshooting Modal Styles */
772+
.troubleshooting-modal {
773+
position: fixed;
774+
top: 0;
775+
left: 0;
776+
width: 100%;
777+
height: 100%;
778+
background: rgba(0, 0, 0, 0.8);
779+
backdrop-filter: blur(5px);
780+
z-index: 5000;
781+
display: flex;
782+
align-items: center;
783+
justify-content: center;
784+
padding: 20px;
785+
box-sizing: border-box;
786+
opacity: 1;
787+
}
788+
789+
.troubleshooting-content {
790+
background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
791+
backdrop-filter: blur(20px);
792+
border-radius: 20px;
793+
padding: 30px;
794+
max-width: 800px;
795+
max-height: 90vh;
796+
overflow-y: auto;
797+
border: 1px solid rgba(255, 255, 255, 0.2);
798+
box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
799+
color: white;
800+
position: relative;
801+
}
802+
803+
.troubleshooting-header {
804+
display: flex;
805+
justify-content: space-between;
806+
align-items: center;
807+
margin-bottom: 20px;
808+
padding-bottom: 15px;
809+
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
810+
}
811+
812+
.troubleshooting-header h2 {
813+
margin: 0;
814+
color: #ff6b6b;
815+
font-size: 24px;
816+
}
817+
818+
.close-modal {
819+
background: rgba(255, 69, 0, 0.7);
820+
color: white;
821+
border: none;
822+
border-radius: 50%;
823+
width: 35px;
824+
height: 35px;
825+
cursor: pointer;
826+
font-size: 18px;
827+
font-weight: bold;
828+
transition: all 0.3s ease;
829+
}
830+
831+
.close-modal:hover {
832+
background: rgba(255, 69, 0, 0.9);
833+
transform: scale(1.1);
834+
}
835+
836+
.error-details {
837+
background: rgba(255, 69, 0, 0.1);
838+
border: 1px solid rgba(255, 69, 0, 0.3);
839+
border-radius: 10px;
840+
padding: 15px;
841+
margin-bottom: 20px;
842+
}
843+
844+
.error-details p {
845+
margin: 0;
846+
color: #ff6b6b;
847+
font-family: monospace;
848+
font-size: 14px;
849+
}
850+
851+
.troubleshooting-steps h3 {
852+
color: #4facfe;
853+
margin-bottom: 15px;
854+
font-size: 18px;
855+
}
856+
857+
.command-group {
858+
margin-bottom: 20px;
859+
padding: 15px;
860+
background: rgba(255, 255, 255, 0.05);
861+
border-radius: 10px;
862+
border: 1px solid rgba(255, 255, 255, 0.1);
863+
}
864+
865+
.command-group h4 {
866+
color: #fff;
867+
margin-bottom: 10px;
868+
font-size: 16px;
869+
}
870+
871+
.command-box {
872+
display: flex;
873+
align-items: center;
874+
gap: 10px;
875+
margin: 10px 0;
876+
padding: 10px;
877+
background: rgba(0, 0, 0, 0.3);
878+
border-radius: 8px;
879+
border: 1px solid rgba(255, 255, 255, 0.1);
880+
}
881+
882+
.command-box code {
883+
flex: 1;
884+
color: #00ff88;
885+
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
886+
font-size: 14px;
887+
background: transparent;
888+
padding: 0;
889+
}
890+
891+
.copy-btn {
892+
background: linear-gradient(45deg, #4facfe 0%, #00f2fe 100%);
893+
color: white;
894+
border: none;
895+
border-radius: 6px;
896+
padding: 6px 12px;
897+
font-size: 12px;
898+
cursor: pointer;
899+
transition: all 0.3s ease;
900+
}
901+
902+
.copy-btn:hover {
903+
transform: translateY(-1px);
904+
box-shadow: 0 4px 8px rgba(79, 172, 254, 0.4);
905+
}
906+
907+
.command-note {
908+
color: rgba(255, 255, 255, 0.7);
909+
font-size: 12px;
910+
margin: 5px 0;
911+
font-style: italic;
912+
}
913+
914+
.troubleshooting-checklist {
915+
margin: 20px 0;
916+
padding: 15px;
917+
background: rgba(76, 175, 80, 0.1);
918+
border: 1px solid rgba(76, 175, 80, 0.3);
919+
border-radius: 10px;
920+
}
921+
922+
.troubleshooting-checklist h3 {
923+
color: #4caf50;
924+
margin-bottom: 10px;
925+
}
926+
927+
.troubleshooting-checklist ul {
928+
list-style: none;
929+
padding: 0;
930+
}
931+
932+
.troubleshooting-checklist li {
933+
color: rgba(255, 255, 255, 0.8);
934+
margin: 8px 0;
935+
font-size: 14px;
936+
}
937+
938+
.troubleshooting-checklist a {
939+
color: #4facfe;
940+
text-decoration: none;
941+
}
942+
943+
.troubleshooting-checklist a:hover {
944+
text-decoration: underline;
945+
}
946+
947+
.troubleshooting-actions {
948+
display: flex;
949+
gap: 10px;
950+
margin-top: 20px;
951+
flex-wrap: wrap;
952+
}
953+
954+
.troubleshooting-actions .btn {
955+
flex: 1;
956+
min-width: 120px;
957+
margin: 0;
958+
}
959+
771960
/* User Agreement Modal Styles */
772961
.user-agreement-modal {
773962
position: fixed;

lib/AIAssistant/AIAssistant-Backend.js

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,33 +1328,47 @@ When user asks for something, generate creative, compact p5.js code that creates
13281328

13291329
// DeepResearch compatibility methods
13301330
async initialize(provider) {
1331-
console.log(`🔌 Direct initialization requested for provider: ${provider}`);
1331+
console.log(`🔌 PLAYGROUND INITIALIZE CALLED - Direct initialization for provider: ${provider}`);
1332+
console.log(`🔍 Current userAgreementAccepted status: ${this.userAgreementAccepted}`);
1333+
13321334
this.setProvider(provider);
13331335

1334-
// Skip user agreement check for direct initialization
1336+
// Force skip user agreement check for direct initialization
13351337
this.userAgreementAccepted = true;
1338+
this.agreementModalOpen = false; // Also ensure no modal is blocking
13361339

1337-
// Directly call the appropriate initialization method
1338-
if (provider === 'ollama') {
1339-
await this.initializeOllama();
1340-
} else if (provider === 'lmstudio') {
1341-
await this.initializeLMStudio();
1342-
} else if (provider === 'openai') {
1343-
// For OpenAI, we need an API key, so we'll still need to show modal
1344-
// But for now, throw an error since we can't initialize without user input
1345-
throw new Error('OpenAI initialization requires API key input - please use the UI');
1346-
} else if (provider === 'local') {
1347-
await this.initializeJanus();
1348-
} else {
1349-
throw new Error(`Unknown provider: ${provider}`);
1350-
}
1340+
console.log(`🔍 Set userAgreementAccepted to: ${this.userAgreementAccepted}`);
13511341

1352-
// Verify connection was successful
1353-
if (!this.isConnected) {
1354-
throw new Error(`Failed to initialize ${provider} - connection was not established`);
1342+
// Directly call the appropriate initialization method WITHOUT any UI modals
1343+
try {
1344+
if (provider === 'ollama') {
1345+
console.log(`🦙 Calling initializeOllama directly...`);
1346+
await this.initializeOllama();
1347+
} else if (provider === 'lmstudio') {
1348+
console.log(`🏠 Calling initializeLMStudio directly...`);
1349+
await this.initializeLMStudio();
1350+
} else if (provider === 'openai') {
1351+
// For OpenAI, we need an API key, so we'll still need to show modal
1352+
// But for now, throw an error since we can't initialize without user input
1353+
throw new Error('OpenAI initialization requires API key input - please use the UI');
1354+
} else if (provider === 'local') {
1355+
console.log(`🤖 Calling initializeJanus directly...`);
1356+
await this.initializeJanus();
1357+
} else {
1358+
throw new Error(`Unknown provider: ${provider}`);
1359+
}
1360+
1361+
// Verify connection was successful
1362+
if (!this.isConnected) {
1363+
throw new Error(`Failed to initialize ${provider} - connection was not established`);
1364+
}
1365+
1366+
console.log(`✅ PLAYGROUND: Successfully initialized ${provider}`);
1367+
1368+
} catch (error) {
1369+
console.error(`❌ PLAYGROUND: Failed to initialize ${provider}:`, error);
1370+
throw error; // Re-throw to ensure playground catches it
13551371
}
1356-
1357-
console.log(`✅ Successfully initialized ${provider}`);
13581372
}
13591373

13601374
get isConnected() {

lib/Pages/Playground/playground.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ class PlaygroundApp {
151151
this.updateStatus('aiStatus', 'Connecting...', 'info');
152152

153153
console.log(`🔌 Attempting to connect to ${provider}...`);
154+
console.log(`🔍 PLAYGROUND: About to call this.aiAssistant.initialize('${provider}')`);
155+
console.log(`🔍 PLAYGROUND: aiAssistant object:`, this.aiAssistant);
156+
console.log(`🔍 PLAYGROUND: aiAssistant.initialize function:`, this.aiAssistant.initialize);
154157

155158
// Actually attempt the connection
156159
await this.aiAssistant.initialize(provider);

0 commit comments

Comments
 (0)