Commit
·
69b1dc4
1
Parent(s):
348f396
updated to use settings for branch selection
Browse files
.github/workflows/commit.yaml
CHANGED
@@ -3,7 +3,7 @@ name: Update Commit Hash File
|
|
3 |
on:
|
4 |
push:
|
5 |
branches:
|
6 |
-
-
|
7 |
|
8 |
permissions:
|
9 |
contents: write
|
@@ -20,17 +20,14 @@ jobs:
|
|
20 |
- name: Get the latest commit hash
|
21 |
run: echo "COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV
|
22 |
|
23 |
-
- name: Get the current branch name
|
24 |
-
run: echo "BRANCH_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
|
25 |
-
|
26 |
- name: Update commit file
|
27 |
run: |
|
28 |
-
echo "{ \"commit\": \"$COMMIT_HASH\"
|
29 |
|
30 |
- name: Commit and push the update
|
31 |
run: |
|
32 |
git config --global user.name "github-actions[bot]"
|
33 |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
34 |
git add app/commit.json
|
35 |
-
git commit -m "chore: update commit hash to $COMMIT_HASH
|
36 |
-
git push
|
|
|
3 |
on:
|
4 |
push:
|
5 |
branches:
|
6 |
+
- main
|
7 |
|
8 |
permissions:
|
9 |
contents: write
|
|
|
20 |
- name: Get the latest commit hash
|
21 |
run: echo "COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV
|
22 |
|
|
|
|
|
|
|
23 |
- name: Update commit file
|
24 |
run: |
|
25 |
+
echo "{ \"commit\": \"$COMMIT_HASH\" }" > app/commit.json
|
26 |
|
27 |
- name: Commit and push the update
|
28 |
run: |
|
29 |
git config --global user.name "github-actions[bot]"
|
30 |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
31 |
git add app/commit.json
|
32 |
+
git commit -m "chore: update commit hash to $COMMIT_HASH"
|
33 |
+
git push
|
app/commit.json
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{ "commit": "87a90718d31bd8ec501cb32f863efd26156fb1e2"
|
|
|
1 |
+
{ "commit": "87a90718d31bd8ec501cb32f863efd26156fb1e2" }
|
app/components/settings/debug/DebugTab.tsx
CHANGED
@@ -202,7 +202,7 @@ const checkProviderStatus = async (url: string | null, providerName: string): Pr
|
|
202 |
};
|
203 |
|
204 |
export default function DebugTab() {
|
205 |
-
const { providers } = useSettings();
|
206 |
const [activeProviders, setActiveProviders] = useState<ProviderStatus[]>([]);
|
207 |
const [updateMessage, setUpdateMessage] = useState<string>('');
|
208 |
const [systemInfo] = useState<SystemInfo>(getSystemInfo());
|
@@ -261,34 +261,26 @@ export default function DebugTab() {
|
|
261 |
setIsCheckingUpdate(true);
|
262 |
setUpdateMessage('Checking for updates...');
|
263 |
|
264 |
-
|
265 |
-
|
266 |
|
267 |
-
|
268 |
-
const localCommitResponse = await fetch(GITHUB_URLS.commitJson(currentBranch));
|
269 |
if (!localCommitResponse.ok) {
|
270 |
throw new Error('Failed to fetch repository information');
|
271 |
}
|
272 |
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
branch: string;
|
277 |
-
}
|
278 |
-
|
279 |
-
const localCommitData: CommitData = await localCommitResponse.json();
|
280 |
-
const originalCommitHash = localCommitData.commit;
|
281 |
-
|
282 |
-
const currentLocalCommitHash = commit.commit;
|
283 |
|
284 |
-
if (
|
285 |
setUpdateMessage(
|
286 |
-
`Update available from
|
287 |
-
`Current: ${
|
288 |
-
`Latest: ${
|
289 |
);
|
290 |
} else {
|
291 |
-
setUpdateMessage(`You are on the latest version from the
|
292 |
}
|
293 |
} catch (error) {
|
294 |
setUpdateMessage('Failed to check for updates');
|
@@ -296,7 +288,7 @@ export default function DebugTab() {
|
|
296 |
} finally {
|
297 |
setIsCheckingUpdate(false);
|
298 |
}
|
299 |
-
}, [isCheckingUpdate]);
|
300 |
|
301 |
const handleCopyToClipboard = useCallback(() => {
|
302 |
const debugInfo = {
|
@@ -311,14 +303,17 @@ export default function DebugTab() {
|
|
311 |
responseTime: provider.responseTime,
|
312 |
url: provider.url,
|
313 |
})),
|
314 |
-
Version:
|
|
|
|
|
|
|
315 |
Timestamp: new Date().toISOString(),
|
316 |
};
|
317 |
|
318 |
navigator.clipboard.writeText(JSON.stringify(debugInfo, null, 2)).then(() => {
|
319 |
toast.success('Debug information copied to clipboard!');
|
320 |
});
|
321 |
-
}, [activeProviders, systemInfo]);
|
322 |
|
323 |
return (
|
324 |
<div className="p-4 space-y-6">
|
|
|
202 |
};
|
203 |
|
204 |
export default function DebugTab() {
|
205 |
+
const { providers, useLatestBranch } = useSettings();
|
206 |
const [activeProviders, setActiveProviders] = useState<ProviderStatus[]>([]);
|
207 |
const [updateMessage, setUpdateMessage] = useState<string>('');
|
208 |
const [systemInfo] = useState<SystemInfo>(getSystemInfo());
|
|
|
261 |
setIsCheckingUpdate(true);
|
262 |
setUpdateMessage('Checking for updates...');
|
263 |
|
264 |
+
const branchToCheck = useLatestBranch ? 'main' : 'stable';
|
265 |
+
console.log(`[Debug] Checking for updates against ${branchToCheck} branch`);
|
266 |
|
267 |
+
const localCommitResponse = await fetch(GITHUB_URLS.commitJson(branchToCheck));
|
|
|
268 |
if (!localCommitResponse.ok) {
|
269 |
throw new Error('Failed to fetch repository information');
|
270 |
}
|
271 |
|
272 |
+
const localCommitData = await localCommitResponse.json();
|
273 |
+
const remoteCommitHash = localCommitData.commit;
|
274 |
+
const currentCommitHash = versionHash;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
275 |
|
276 |
+
if (remoteCommitHash !== currentCommitHash) {
|
277 |
setUpdateMessage(
|
278 |
+
`Update available from ${branchToCheck} branch!\n` +
|
279 |
+
`Current: ${currentCommitHash.slice(0, 7)}\n` +
|
280 |
+
`Latest: ${remoteCommitHash.slice(0, 7)}`
|
281 |
);
|
282 |
} else {
|
283 |
+
setUpdateMessage(`You are on the latest version from the ${branchToCheck} branch`);
|
284 |
}
|
285 |
} catch (error) {
|
286 |
setUpdateMessage('Failed to check for updates');
|
|
|
288 |
} finally {
|
289 |
setIsCheckingUpdate(false);
|
290 |
}
|
291 |
+
}, [isCheckingUpdate, useLatestBranch]);
|
292 |
|
293 |
const handleCopyToClipboard = useCallback(() => {
|
294 |
const debugInfo = {
|
|
|
303 |
responseTime: provider.responseTime,
|
304 |
url: provider.url,
|
305 |
})),
|
306 |
+
Version: {
|
307 |
+
hash: versionHash.slice(0, 7),
|
308 |
+
branch: useLatestBranch ? 'main' : 'stable'
|
309 |
+
},
|
310 |
Timestamp: new Date().toISOString(),
|
311 |
};
|
312 |
|
313 |
navigator.clipboard.writeText(JSON.stringify(debugInfo, null, 2)).then(() => {
|
314 |
toast.success('Debug information copied to clipboard!');
|
315 |
});
|
316 |
+
}, [activeProviders, systemInfo, useLatestBranch]);
|
317 |
|
318 |
return (
|
319 |
<div className="p-4 space-y-6">
|
app/components/settings/features/FeaturesTab.tsx
CHANGED
@@ -3,7 +3,7 @@ import { Switch } from '~/components/ui/Switch';
|
|
3 |
import { useSettings } from '~/lib/hooks/useSettings';
|
4 |
|
5 |
export default function FeaturesTab() {
|
6 |
-
const { debug, enableDebugMode, isLocalModel, enableLocalModels, eventLogs, enableEventLogs } = useSettings();
|
7 |
|
8 |
const handleToggle = (enabled: boolean) => {
|
9 |
enableDebugMode(enabled);
|
@@ -14,9 +14,18 @@ export default function FeaturesTab() {
|
|
14 |
<div className="p-4 bg-bolt-elements-bg-depth-2 border border-bolt-elements-borderColor rounded-lg mb-4">
|
15 |
<div className="mb-6">
|
16 |
<h3 className="text-lg font-medium text-bolt-elements-textPrimary mb-4">Optional Features</h3>
|
17 |
-
<div className="
|
18 |
-
<
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
</div>
|
21 |
</div>
|
22 |
|
|
|
3 |
import { useSettings } from '~/lib/hooks/useSettings';
|
4 |
|
5 |
export default function FeaturesTab() {
|
6 |
+
const { debug, enableDebugMode, isLocalModel, enableLocalModels, eventLogs, enableEventLogs, useLatestBranch, enableLatestBranch } = useSettings();
|
7 |
|
8 |
const handleToggle = (enabled: boolean) => {
|
9 |
enableDebugMode(enabled);
|
|
|
14 |
<div className="p-4 bg-bolt-elements-bg-depth-2 border border-bolt-elements-borderColor rounded-lg mb-4">
|
15 |
<div className="mb-6">
|
16 |
<h3 className="text-lg font-medium text-bolt-elements-textPrimary mb-4">Optional Features</h3>
|
17 |
+
<div className="space-y-4">
|
18 |
+
<div className="flex items-center justify-between">
|
19 |
+
<span className="text-bolt-elements-textPrimary">Debug Features</span>
|
20 |
+
<Switch className="ml-auto" checked={debug} onCheckedChange={handleToggle} />
|
21 |
+
</div>
|
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">Check for updates against the main branch instead of stable</p>
|
26 |
+
</div>
|
27 |
+
<Switch className="ml-auto" checked={useLatestBranch} onCheckedChange={enableLatestBranch} />
|
28 |
+
</div>
|
29 |
</div>
|
30 |
</div>
|
31 |
|
app/lib/hooks/useSettings.tsx
CHANGED
@@ -5,6 +5,7 @@ import {
|
|
5 |
isLocalModelsEnabled,
|
6 |
LOCAL_PROVIDERS,
|
7 |
providersStore,
|
|
|
8 |
} from '~/lib/stores/settings';
|
9 |
import { useCallback, useEffect, useState } from 'react';
|
10 |
import Cookies from 'js-cookie';
|
@@ -16,6 +17,7 @@ export function useSettings() {
|
|
16 |
const debug = useStore(isDebugMode);
|
17 |
const eventLogs = useStore(isEventLogsEnabled);
|
18 |
const isLocalModel = useStore(isLocalModelsEnabled);
|
|
|
19 |
const [activeProviders, setActiveProviders] = useState<ProviderInfo[]>([]);
|
20 |
|
21 |
// reading values from cookies on mount
|
@@ -60,6 +62,13 @@ export function useSettings() {
|
|
60 |
if (savedLocalModels) {
|
61 |
isLocalModelsEnabled.set(savedLocalModels === 'true');
|
62 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
}, []);
|
64 |
|
65 |
// writing values to cookies on change
|
@@ -111,6 +120,12 @@ export function useSettings() {
|
|
111 |
Cookies.set('isLocalModelsEnabled', String(enabled));
|
112 |
}, []);
|
113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
return {
|
115 |
providers,
|
116 |
activeProviders,
|
@@ -121,5 +136,7 @@ export function useSettings() {
|
|
121 |
enableEventLogs,
|
122 |
isLocalModel,
|
123 |
enableLocalModels,
|
|
|
|
|
124 |
};
|
125 |
}
|
|
|
5 |
isLocalModelsEnabled,
|
6 |
LOCAL_PROVIDERS,
|
7 |
providersStore,
|
8 |
+
useLatestBranch,
|
9 |
} from '~/lib/stores/settings';
|
10 |
import { useCallback, useEffect, useState } from 'react';
|
11 |
import Cookies from 'js-cookie';
|
|
|
17 |
const debug = useStore(isDebugMode);
|
18 |
const eventLogs = useStore(isEventLogsEnabled);
|
19 |
const isLocalModel = useStore(isLocalModelsEnabled);
|
20 |
+
const useLatest = useStore(useLatestBranch);
|
21 |
const [activeProviders, setActiveProviders] = useState<ProviderInfo[]>([]);
|
22 |
|
23 |
// reading values from cookies on mount
|
|
|
62 |
if (savedLocalModels) {
|
63 |
isLocalModelsEnabled.set(savedLocalModels === 'true');
|
64 |
}
|
65 |
+
|
66 |
+
// load latest branch setting from cookies
|
67 |
+
const savedLatestBranch = Cookies.get('useLatestBranch');
|
68 |
+
|
69 |
+
if (savedLatestBranch) {
|
70 |
+
useLatestBranch.set(savedLatestBranch === 'true');
|
71 |
+
}
|
72 |
}, []);
|
73 |
|
74 |
// writing values to cookies on change
|
|
|
120 |
Cookies.set('isLocalModelsEnabled', String(enabled));
|
121 |
}, []);
|
122 |
|
123 |
+
const enableLatestBranch = useCallback((enabled: boolean) => {
|
124 |
+
useLatestBranch.set(enabled);
|
125 |
+
logStore.logSystem(`Main branch updates ${enabled ? 'enabled' : 'disabled'}`);
|
126 |
+
Cookies.set('useLatestBranch', String(enabled));
|
127 |
+
}, []);
|
128 |
+
|
129 |
return {
|
130 |
providers,
|
131 |
activeProviders,
|
|
|
136 |
enableEventLogs,
|
137 |
isLocalModel,
|
138 |
enableLocalModels,
|
139 |
+
useLatestBranch: useLatest,
|
140 |
+
enableLatestBranch,
|
141 |
};
|
142 |
}
|
app/lib/stores/settings.ts
CHANGED
@@ -46,3 +46,5 @@ export const isDebugMode = atom(false);
|
|
46 |
export const isEventLogsEnabled = atom(false);
|
47 |
|
48 |
export const isLocalModelsEnabled = atom(true);
|
|
|
|
|
|
46 |
export const isEventLogsEnabled = atom(false);
|
47 |
|
48 |
export const isLocalModelsEnabled = atom(true);
|
49 |
+
|
50 |
+
export const useLatestBranch = atom(false);
|