Lint fix
Browse files
app/components/chat/BaseChat.tsx
CHANGED
@@ -77,7 +77,6 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
|
|
77 |
input = '',
|
78 |
enhancingPrompt,
|
79 |
handleInputChange,
|
80 |
-
promptEnhanced,
|
81 |
enhancePrompt,
|
82 |
sendMessage,
|
83 |
handleStop,
|
@@ -490,10 +489,7 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
|
|
490 |
<IconButton
|
491 |
title="Enhance prompt"
|
492 |
disabled={input.length === 0 || enhancingPrompt}
|
493 |
-
className={classNames(
|
494 |
-
'transition-all',
|
495 |
-
enhancingPrompt ? 'opacity-100' : '',
|
496 |
-
)}
|
497 |
onClick={() => {
|
498 |
enhancePrompt?.();
|
499 |
toast.success('Prompt enhanced!');
|
|
|
77 |
input = '',
|
78 |
enhancingPrompt,
|
79 |
handleInputChange,
|
|
|
80 |
enhancePrompt,
|
81 |
sendMessage,
|
82 |
handleStop,
|
|
|
489 |
<IconButton
|
490 |
title="Enhance prompt"
|
491 |
disabled={input.length === 0 || enhancingPrompt}
|
492 |
+
className={classNames('transition-all', enhancingPrompt ? 'opacity-100' : '')}
|
|
|
|
|
|
|
493 |
onClick={() => {
|
494 |
enhancePrompt?.();
|
495 |
toast.success('Prompt enhanced!');
|
app/components/settings/chat-history/ChatHistoryTab.tsx
CHANGED
@@ -22,7 +22,8 @@ export default function ChatHistoryTab() {
|
|
22 |
};
|
23 |
|
24 |
const handleDeleteAllChats = async () => {
|
25 |
-
const confirmDelete = window.confirm(
|
|
|
26 |
if (!confirmDelete) {
|
27 |
return; // Exit if the user cancels
|
28 |
}
|
@@ -31,11 +32,13 @@ export default function ChatHistoryTab() {
|
|
31 |
const error = new Error('Database is not available');
|
32 |
logStore.logError('Failed to delete chats - DB unavailable', error);
|
33 |
toast.error('Database is not available');
|
|
|
34 |
return;
|
35 |
}
|
36 |
|
37 |
try {
|
38 |
setIsDeleting(true);
|
|
|
39 |
const allChats = await getAll(db);
|
40 |
await Promise.all(allChats.map((chat) => deleteById(db!, chat.id)));
|
41 |
logStore.logSystem('All chats deleted successfully', { count: allChats.length });
|
@@ -55,6 +58,7 @@ export default function ChatHistoryTab() {
|
|
55 |
const error = new Error('Database is not available');
|
56 |
logStore.logError('Failed to export chats - DB unavailable', error);
|
57 |
toast.error('Database is not available');
|
|
|
58 |
return;
|
59 |
}
|
60 |
|
|
|
22 |
};
|
23 |
|
24 |
const handleDeleteAllChats = async () => {
|
25 |
+
const confirmDelete = window.confirm('Are you sure you want to delete all chats? This action cannot be undone.');
|
26 |
+
|
27 |
if (!confirmDelete) {
|
28 |
return; // Exit if the user cancels
|
29 |
}
|
|
|
32 |
const error = new Error('Database is not available');
|
33 |
logStore.logError('Failed to delete chats - DB unavailable', error);
|
34 |
toast.error('Database is not available');
|
35 |
+
|
36 |
return;
|
37 |
}
|
38 |
|
39 |
try {
|
40 |
setIsDeleting(true);
|
41 |
+
|
42 |
const allChats = await getAll(db);
|
43 |
await Promise.all(allChats.map((chat) => deleteById(db!, chat.id)));
|
44 |
logStore.logSystem('All chats deleted successfully', { count: allChats.length });
|
|
|
58 |
const error = new Error('Database is not available');
|
59 |
logStore.logError('Failed to export chats - DB unavailable', error);
|
60 |
toast.error('Database is not available');
|
61 |
+
|
62 |
return;
|
63 |
}
|
64 |
|
app/components/settings/debug/DebugTab.tsx
CHANGED
@@ -41,7 +41,8 @@ const versionHash = commit.commit;
|
|
41 |
const GITHUB_URLS = {
|
42 |
original: 'https://api.github.com/repos/stackblitz-labs/bolt.diy/commits/main',
|
43 |
fork: 'https://api.github.com/repos/Stijnus/bolt.new-any-llm/commits/main',
|
44 |
-
commitJson: (branch: string) =>
|
|
|
45 |
};
|
46 |
|
47 |
function getSystemInfo(): SystemInfo {
|
@@ -227,19 +228,20 @@ export default function DebugTab() {
|
|
227 |
provider.name.toLowerCase() === 'ollama'
|
228 |
? 'OLLAMA_API_BASE_URL'
|
229 |
: provider.name.toLowerCase() === 'lmstudio'
|
230 |
-
|
231 |
-
|
232 |
|
233 |
// Access environment variables through import.meta.env
|
234 |
const url = import.meta.env[envVarName] || provider.settings.baseUrl || null; // Ensure baseUrl is used
|
235 |
console.log(`[Debug] Using URL for ${provider.name}:`, url, `(from ${envVarName})`);
|
236 |
|
237 |
const status = await checkProviderStatus(url, provider.name);
|
|
|
238 |
return {
|
239 |
...status,
|
240 |
enabled: provider.settings.enabled ?? false,
|
241 |
};
|
242 |
-
})
|
243 |
);
|
244 |
|
245 |
setActiveProviders(statuses);
|
@@ -269,19 +271,20 @@ export default function DebugTab() {
|
|
269 |
console.log(`[Debug] Checking for updates against ${branchToCheck} branch`);
|
270 |
|
271 |
const localCommitResponse = await fetch(GITHUB_URLS.commitJson(branchToCheck));
|
|
|
272 |
if (!localCommitResponse.ok) {
|
273 |
throw new Error('Failed to fetch local commit info');
|
274 |
}
|
275 |
|
276 |
-
const localCommitData = await localCommitResponse.json() as CommitData;
|
277 |
const remoteCommitHash = localCommitData.commit;
|
278 |
const currentCommitHash = versionHash;
|
279 |
|
280 |
if (remoteCommitHash !== currentCommitHash) {
|
281 |
setUpdateMessage(
|
282 |
`Update available from ${branchToCheck} branch!\n` +
|
283 |
-
|
284 |
-
|
285 |
);
|
286 |
} else {
|
287 |
setUpdateMessage(`You are on the latest version from the ${branchToCheck} branch`);
|
@@ -309,7 +312,7 @@ export default function DebugTab() {
|
|
309 |
})),
|
310 |
Version: {
|
311 |
hash: versionHash.slice(0, 7),
|
312 |
-
branch: useLatestBranch ? 'main' : 'stable'
|
313 |
},
|
314 |
Timestamp: new Date().toISOString(),
|
315 |
};
|
|
|
41 |
const GITHUB_URLS = {
|
42 |
original: 'https://api.github.com/repos/stackblitz-labs/bolt.diy/commits/main',
|
43 |
fork: 'https://api.github.com/repos/Stijnus/bolt.new-any-llm/commits/main',
|
44 |
+
commitJson: (branch: string) =>
|
45 |
+
`https://raw.githubusercontent.com/stackblitz-labs/bolt.diy/${branch}/app/commit.json`,
|
46 |
};
|
47 |
|
48 |
function getSystemInfo(): SystemInfo {
|
|
|
228 |
provider.name.toLowerCase() === 'ollama'
|
229 |
? 'OLLAMA_API_BASE_URL'
|
230 |
: provider.name.toLowerCase() === 'lmstudio'
|
231 |
+
? 'LMSTUDIO_API_BASE_URL'
|
232 |
+
: `REACT_APP_${provider.name.toUpperCase()}_URL`;
|
233 |
|
234 |
// Access environment variables through import.meta.env
|
235 |
const url = import.meta.env[envVarName] || provider.settings.baseUrl || null; // Ensure baseUrl is used
|
236 |
console.log(`[Debug] Using URL for ${provider.name}:`, url, `(from ${envVarName})`);
|
237 |
|
238 |
const status = await checkProviderStatus(url, provider.name);
|
239 |
+
|
240 |
return {
|
241 |
...status,
|
242 |
enabled: provider.settings.enabled ?? false,
|
243 |
};
|
244 |
+
}),
|
245 |
);
|
246 |
|
247 |
setActiveProviders(statuses);
|
|
|
271 |
console.log(`[Debug] Checking for updates against ${branchToCheck} branch`);
|
272 |
|
273 |
const localCommitResponse = await fetch(GITHUB_URLS.commitJson(branchToCheck));
|
274 |
+
|
275 |
if (!localCommitResponse.ok) {
|
276 |
throw new Error('Failed to fetch local commit info');
|
277 |
}
|
278 |
|
279 |
+
const localCommitData = (await localCommitResponse.json()) as CommitData;
|
280 |
const remoteCommitHash = localCommitData.commit;
|
281 |
const currentCommitHash = versionHash;
|
282 |
|
283 |
if (remoteCommitHash !== currentCommitHash) {
|
284 |
setUpdateMessage(
|
285 |
`Update available from ${branchToCheck} branch!\n` +
|
286 |
+
`Current: ${currentCommitHash.slice(0, 7)}\n` +
|
287 |
+
`Latest: ${remoteCommitHash.slice(0, 7)}`,
|
288 |
);
|
289 |
} else {
|
290 |
setUpdateMessage(`You are on the latest version from the ${branchToCheck} branch`);
|
|
|
312 |
})),
|
313 |
Version: {
|
314 |
hash: versionHash.slice(0, 7),
|
315 |
+
branch: useLatestBranch ? 'main' : 'stable',
|
316 |
},
|
317 |
Timestamp: new Date().toISOString(),
|
318 |
};
|
app/components/settings/features/FeaturesTab.tsx
CHANGED
@@ -3,7 +3,15 @@ import { Switch } from '~/components/ui/Switch';
|
|
3 |
import { useSettings } from '~/lib/hooks/useSettings';
|
4 |
|
5 |
export default function FeaturesTab() {
|
6 |
-
const {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
const handleToggle = (enabled: boolean) => {
|
9 |
enableDebugMode(enabled);
|
@@ -22,7 +30,9 @@ export default function FeaturesTab() {
|
|
22 |
<div className="flex items-center justify-between">
|
23 |
<div>
|
24 |
<span className="text-bolt-elements-textPrimary">Use Main Branch</span>
|
25 |
-
<p className="text-sm text-bolt-elements-textSecondary">
|
|
|
|
|
26 |
</div>
|
27 |
<Switch className="ml-auto" checked={useLatestBranch} onCheckedChange={enableLatestBranch} />
|
28 |
</div>
|
|
|
3 |
import { useSettings } from '~/lib/hooks/useSettings';
|
4 |
|
5 |
export default function FeaturesTab() {
|
6 |
+
const {
|
7 |
+
debug,
|
8 |
+
enableDebugMode,
|
9 |
+
isLocalModel,
|
10 |
+
enableLocalModels,
|
11 |
+
enableEventLogs,
|
12 |
+
useLatestBranch,
|
13 |
+
enableLatestBranch,
|
14 |
+
} = useSettings();
|
15 |
|
16 |
const handleToggle = (enabled: boolean) => {
|
17 |
enableDebugMode(enabled);
|
|
|
30 |
<div className="flex items-center justify-between">
|
31 |
<div>
|
32 |
<span className="text-bolt-elements-textPrimary">Use Main Branch</span>
|
33 |
+
<p className="text-sm text-bolt-elements-textSecondary">
|
34 |
+
Check for updates against the main branch instead of stable
|
35 |
+
</p>
|
36 |
</div>
|
37 |
<Switch className="ml-auto" checked={useLatestBranch} onCheckedChange={enableLatestBranch} />
|
38 |
</div>
|
app/components/settings/providers/ProvidersTab.tsx
CHANGED
@@ -56,7 +56,8 @@ export default function ProvidersTab() {
|
|
56 |
<div className="flex items-center gap-2">
|
57 |
<img
|
58 |
src={`/icons/${provider.name}.svg`} // Attempt to load the specific icon
|
59 |
-
onError={(e) => {
|
|
|
60 |
e.currentTarget.src = DefaultIcon;
|
61 |
}}
|
62 |
alt={`${provider.name} icon`}
|
|
|
56 |
<div className="flex items-center gap-2">
|
57 |
<img
|
58 |
src={`/icons/${provider.name}.svg`} // Attempt to load the specific icon
|
59 |
+
onError={(e) => {
|
60 |
+
// Fallback to default icon on error
|
61 |
e.currentTarget.src = DefaultIcon;
|
62 |
}}
|
63 |
alt={`${provider.name} icon`}
|
app/lib/hooks/useSettings.tsx
CHANGED
@@ -28,12 +28,17 @@ export function useSettings() {
|
|
28 |
// Function to check if we're on stable version
|
29 |
const checkIsStableVersion = async () => {
|
30 |
try {
|
31 |
-
const stableResponse = await fetch(
|
|
|
|
|
|
|
32 |
if (!stableResponse.ok) {
|
33 |
console.warn('Failed to fetch stable commit info');
|
34 |
return false;
|
35 |
}
|
36 |
-
|
|
|
|
|
37 |
return commit.commit === stableData.commit;
|
38 |
} catch (error) {
|
39 |
console.warn('Error checking stable version:', error);
|
@@ -86,9 +91,10 @@ export function useSettings() {
|
|
86 |
|
87 |
// load latest branch setting from cookies or determine based on version
|
88 |
const savedLatestBranch = Cookies.get('useLatestBranch');
|
|
|
89 |
if (savedLatestBranch === undefined) {
|
90 |
// If setting hasn't been set by user, check version
|
91 |
-
checkIsStableVersion().then(isStable => {
|
92 |
const shouldUseLatest = !isStable;
|
93 |
latestBranch.set(shouldUseLatest);
|
94 |
Cookies.set('useLatestBranch', String(shouldUseLatest));
|
|
|
28 |
// Function to check if we're on stable version
|
29 |
const checkIsStableVersion = async () => {
|
30 |
try {
|
31 |
+
const stableResponse = await fetch(
|
32 |
+
'https://raw.githubusercontent.com/stackblitz-labs/bolt.diy/stable/app/commit.json',
|
33 |
+
);
|
34 |
+
|
35 |
if (!stableResponse.ok) {
|
36 |
console.warn('Failed to fetch stable commit info');
|
37 |
return false;
|
38 |
}
|
39 |
+
|
40 |
+
const stableData = (await stableResponse.json()) as CommitData;
|
41 |
+
|
42 |
return commit.commit === stableData.commit;
|
43 |
} catch (error) {
|
44 |
console.warn('Error checking stable version:', error);
|
|
|
91 |
|
92 |
// load latest branch setting from cookies or determine based on version
|
93 |
const savedLatestBranch = Cookies.get('useLatestBranch');
|
94 |
+
|
95 |
if (savedLatestBranch === undefined) {
|
96 |
// If setting hasn't been set by user, check version
|
97 |
+
checkIsStableVersion().then((isStable) => {
|
98 |
const shouldUseLatest = !isStable;
|
99 |
latestBranch.set(shouldUseLatest);
|
100 |
Cookies.set('useLatestBranch', String(shouldUseLatest));
|