mirror of
https://github.com/stackblitz/bolt.new
synced 2025-02-05 20:46:43 +00:00
Lint fix
This commit is contained in:
parent
1b76d3c28f
commit
070e911be1
@ -77,7 +77,6 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
|
|||||||
input = '',
|
input = '',
|
||||||
enhancingPrompt,
|
enhancingPrompt,
|
||||||
handleInputChange,
|
handleInputChange,
|
||||||
promptEnhanced,
|
|
||||||
enhancePrompt,
|
enhancePrompt,
|
||||||
sendMessage,
|
sendMessage,
|
||||||
handleStop,
|
handleStop,
|
||||||
@ -490,10 +489,7 @@ export const BaseChat = React.forwardRef<HTMLDivElement, BaseChatProps>(
|
|||||||
<IconButton
|
<IconButton
|
||||||
title="Enhance prompt"
|
title="Enhance prompt"
|
||||||
disabled={input.length === 0 || enhancingPrompt}
|
disabled={input.length === 0 || enhancingPrompt}
|
||||||
className={classNames(
|
className={classNames('transition-all', enhancingPrompt ? 'opacity-100' : '')}
|
||||||
'transition-all',
|
|
||||||
enhancingPrompt ? 'opacity-100' : '',
|
|
||||||
)}
|
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
enhancePrompt?.();
|
enhancePrompt?.();
|
||||||
toast.success('Prompt enhanced!');
|
toast.success('Prompt enhanced!');
|
||||||
|
@ -22,7 +22,8 @@ export default function ChatHistoryTab() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleDeleteAllChats = async () => {
|
const handleDeleteAllChats = async () => {
|
||||||
const confirmDelete = window.confirm("Are you sure you want to delete all chats? This action cannot be undone.");
|
const confirmDelete = window.confirm('Are you sure you want to delete all chats? This action cannot be undone.');
|
||||||
|
|
||||||
if (!confirmDelete) {
|
if (!confirmDelete) {
|
||||||
return; // Exit if the user cancels
|
return; // Exit if the user cancels
|
||||||
}
|
}
|
||||||
@ -31,11 +32,13 @@ export default function ChatHistoryTab() {
|
|||||||
const error = new Error('Database is not available');
|
const error = new Error('Database is not available');
|
||||||
logStore.logError('Failed to delete chats - DB unavailable', error);
|
logStore.logError('Failed to delete chats - DB unavailable', error);
|
||||||
toast.error('Database is not available');
|
toast.error('Database is not available');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
setIsDeleting(true);
|
setIsDeleting(true);
|
||||||
|
|
||||||
const allChats = await getAll(db);
|
const allChats = await getAll(db);
|
||||||
await Promise.all(allChats.map((chat) => deleteById(db!, chat.id)));
|
await Promise.all(allChats.map((chat) => deleteById(db!, chat.id)));
|
||||||
logStore.logSystem('All chats deleted successfully', { count: allChats.length });
|
logStore.logSystem('All chats deleted successfully', { count: allChats.length });
|
||||||
@ -55,6 +58,7 @@ export default function ChatHistoryTab() {
|
|||||||
const error = new Error('Database is not available');
|
const error = new Error('Database is not available');
|
||||||
logStore.logError('Failed to export chats - DB unavailable', error);
|
logStore.logError('Failed to export chats - DB unavailable', error);
|
||||||
toast.error('Database is not available');
|
toast.error('Database is not available');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,8 @@ const versionHash = commit.commit;
|
|||||||
const GITHUB_URLS = {
|
const GITHUB_URLS = {
|
||||||
original: 'https://api.github.com/repos/stackblitz-labs/bolt.diy/commits/main',
|
original: 'https://api.github.com/repos/stackblitz-labs/bolt.diy/commits/main',
|
||||||
fork: 'https://api.github.com/repos/Stijnus/bolt.new-any-llm/commits/main',
|
fork: 'https://api.github.com/repos/Stijnus/bolt.new-any-llm/commits/main',
|
||||||
commitJson: (branch: string) => `https://raw.githubusercontent.com/stackblitz-labs/bolt.diy/${branch}/app/commit.json`,
|
commitJson: (branch: string) =>
|
||||||
|
`https://raw.githubusercontent.com/stackblitz-labs/bolt.diy/${branch}/app/commit.json`,
|
||||||
};
|
};
|
||||||
|
|
||||||
function getSystemInfo(): SystemInfo {
|
function getSystemInfo(): SystemInfo {
|
||||||
@ -235,11 +236,12 @@ export default function DebugTab() {
|
|||||||
console.log(`[Debug] Using URL for ${provider.name}:`, url, `(from ${envVarName})`);
|
console.log(`[Debug] Using URL for ${provider.name}:`, url, `(from ${envVarName})`);
|
||||||
|
|
||||||
const status = await checkProviderStatus(url, provider.name);
|
const status = await checkProviderStatus(url, provider.name);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...status,
|
...status,
|
||||||
enabled: provider.settings.enabled ?? false,
|
enabled: provider.settings.enabled ?? false,
|
||||||
};
|
};
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
setActiveProviders(statuses);
|
setActiveProviders(statuses);
|
||||||
@ -269,11 +271,12 @@ export default function DebugTab() {
|
|||||||
console.log(`[Debug] Checking for updates against ${branchToCheck} branch`);
|
console.log(`[Debug] Checking for updates against ${branchToCheck} branch`);
|
||||||
|
|
||||||
const localCommitResponse = await fetch(GITHUB_URLS.commitJson(branchToCheck));
|
const localCommitResponse = await fetch(GITHUB_URLS.commitJson(branchToCheck));
|
||||||
|
|
||||||
if (!localCommitResponse.ok) {
|
if (!localCommitResponse.ok) {
|
||||||
throw new Error('Failed to fetch local commit info');
|
throw new Error('Failed to fetch local commit info');
|
||||||
}
|
}
|
||||||
|
|
||||||
const localCommitData = await localCommitResponse.json() as CommitData;
|
const localCommitData = (await localCommitResponse.json()) as CommitData;
|
||||||
const remoteCommitHash = localCommitData.commit;
|
const remoteCommitHash = localCommitData.commit;
|
||||||
const currentCommitHash = versionHash;
|
const currentCommitHash = versionHash;
|
||||||
|
|
||||||
@ -281,7 +284,7 @@ export default function DebugTab() {
|
|||||||
setUpdateMessage(
|
setUpdateMessage(
|
||||||
`Update available from ${branchToCheck} branch!\n` +
|
`Update available from ${branchToCheck} branch!\n` +
|
||||||
`Current: ${currentCommitHash.slice(0, 7)}\n` +
|
`Current: ${currentCommitHash.slice(0, 7)}\n` +
|
||||||
`Latest: ${remoteCommitHash.slice(0, 7)}`
|
`Latest: ${remoteCommitHash.slice(0, 7)}`,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
setUpdateMessage(`You are on the latest version from the ${branchToCheck} branch`);
|
setUpdateMessage(`You are on the latest version from the ${branchToCheck} branch`);
|
||||||
@ -309,7 +312,7 @@ export default function DebugTab() {
|
|||||||
})),
|
})),
|
||||||
Version: {
|
Version: {
|
||||||
hash: versionHash.slice(0, 7),
|
hash: versionHash.slice(0, 7),
|
||||||
branch: useLatestBranch ? 'main' : 'stable'
|
branch: useLatestBranch ? 'main' : 'stable',
|
||||||
},
|
},
|
||||||
Timestamp: new Date().toISOString(),
|
Timestamp: new Date().toISOString(),
|
||||||
};
|
};
|
||||||
|
@ -3,7 +3,15 @@ import { Switch } from '~/components/ui/Switch';
|
|||||||
import { useSettings } from '~/lib/hooks/useSettings';
|
import { useSettings } from '~/lib/hooks/useSettings';
|
||||||
|
|
||||||
export default function FeaturesTab() {
|
export default function FeaturesTab() {
|
||||||
const { debug, enableDebugMode, isLocalModel, enableLocalModels, eventLogs, enableEventLogs, useLatestBranch, enableLatestBranch } = useSettings();
|
const {
|
||||||
|
debug,
|
||||||
|
enableDebugMode,
|
||||||
|
isLocalModel,
|
||||||
|
enableLocalModels,
|
||||||
|
enableEventLogs,
|
||||||
|
useLatestBranch,
|
||||||
|
enableLatestBranch,
|
||||||
|
} = useSettings();
|
||||||
|
|
||||||
const handleToggle = (enabled: boolean) => {
|
const handleToggle = (enabled: boolean) => {
|
||||||
enableDebugMode(enabled);
|
enableDebugMode(enabled);
|
||||||
@ -22,7 +30,9 @@ export default function FeaturesTab() {
|
|||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<div>
|
<div>
|
||||||
<span className="text-bolt-elements-textPrimary">Use Main Branch</span>
|
<span className="text-bolt-elements-textPrimary">Use Main Branch</span>
|
||||||
<p className="text-sm text-bolt-elements-textSecondary">Check for updates against the main branch instead of stable</p>
|
<p className="text-sm text-bolt-elements-textSecondary">
|
||||||
|
Check for updates against the main branch instead of stable
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<Switch className="ml-auto" checked={useLatestBranch} onCheckedChange={enableLatestBranch} />
|
<Switch className="ml-auto" checked={useLatestBranch} onCheckedChange={enableLatestBranch} />
|
||||||
</div>
|
</div>
|
||||||
|
@ -56,7 +56,8 @@ export default function ProvidersTab() {
|
|||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<img
|
<img
|
||||||
src={`/icons/${provider.name}.svg`} // Attempt to load the specific icon
|
src={`/icons/${provider.name}.svg`} // Attempt to load the specific icon
|
||||||
onError={(e) => { // Fallback to default icon on error
|
onError={(e) => {
|
||||||
|
// Fallback to default icon on error
|
||||||
e.currentTarget.src = DefaultIcon;
|
e.currentTarget.src = DefaultIcon;
|
||||||
}}
|
}}
|
||||||
alt={`${provider.name} icon`}
|
alt={`${provider.name} icon`}
|
||||||
|
@ -28,12 +28,17 @@ export function useSettings() {
|
|||||||
// Function to check if we're on stable version
|
// Function to check if we're on stable version
|
||||||
const checkIsStableVersion = async () => {
|
const checkIsStableVersion = async () => {
|
||||||
try {
|
try {
|
||||||
const stableResponse = await fetch('https://raw.githubusercontent.com/stackblitz-labs/bolt.diy/stable/app/commit.json');
|
const stableResponse = await fetch(
|
||||||
|
'https://raw.githubusercontent.com/stackblitz-labs/bolt.diy/stable/app/commit.json',
|
||||||
|
);
|
||||||
|
|
||||||
if (!stableResponse.ok) {
|
if (!stableResponse.ok) {
|
||||||
console.warn('Failed to fetch stable commit info');
|
console.warn('Failed to fetch stable commit info');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const stableData = await stableResponse.json() as CommitData;
|
|
||||||
|
const stableData = (await stableResponse.json()) as CommitData;
|
||||||
|
|
||||||
return commit.commit === stableData.commit;
|
return commit.commit === stableData.commit;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.warn('Error checking stable version:', error);
|
console.warn('Error checking stable version:', error);
|
||||||
@ -86,9 +91,10 @@ export function useSettings() {
|
|||||||
|
|
||||||
// load latest branch setting from cookies or determine based on version
|
// load latest branch setting from cookies or determine based on version
|
||||||
const savedLatestBranch = Cookies.get('useLatestBranch');
|
const savedLatestBranch = Cookies.get('useLatestBranch');
|
||||||
|
|
||||||
if (savedLatestBranch === undefined) {
|
if (savedLatestBranch === undefined) {
|
||||||
// If setting hasn't been set by user, check version
|
// If setting hasn't been set by user, check version
|
||||||
checkIsStableVersion().then(isStable => {
|
checkIsStableVersion().then((isStable) => {
|
||||||
const shouldUseLatest = !isStable;
|
const shouldUseLatest = !isStable;
|
||||||
latestBranch.set(shouldUseLatest);
|
latestBranch.set(shouldUseLatest);
|
||||||
Cookies.set('useLatestBranch', String(shouldUseLatest));
|
Cookies.set('useLatestBranch', String(shouldUseLatest));
|
||||||
|
Loading…
Reference in New Issue
Block a user