Skip to content

Commit d473b2b

Browse files
committed
Merge branch 'main' into system-prompt-variations-local
2 parents bb94180 + 7158ad6 commit d473b2b

File tree

8 files changed

+225
-99
lines changed

8 files changed

+225
-99
lines changed

.github/workflows/commit.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929

3030
- name: Update commit file
3131
run: |
32-
echo CURRENT_VERSION=$(node -p "require('./package.json').version") >> $GITHUB_ENV
32+
echo "CURRENT_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV
3333
echo "{ \"commit\": \"$COMMIT_HASH\" , \"version\": \"$CURRENT_VERSION\" }" > app/commit.json
3434
3535
- name: Commit and push the update

app/commit.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "commit": "19a3a03d455a5042cd3f8c654b0498c4cde2ea75" }
1+
{ "commit": "bb941802094c6186e805f99a6c165431ae86d216" }

app/components/chat/Messages.client.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ export const Messages = React.forwardRef<HTMLDivElement, MessagesProps>((props:
7373
</div>
7474
{!isUserMessage && (
7575
<div className="flex gap-2 flex-col lg:flex-row">
76-
<WithTooltip tooltip="Revert to this message">
77-
{messageId && (
76+
{messageId && (
77+
<WithTooltip tooltip="Revert to this message">
7878
<button
7979
onClick={() => handleRewind(messageId)}
8080
key="i-ph:arrow-u-up-left"
@@ -83,8 +83,8 @@ export const Messages = React.forwardRef<HTMLDivElement, MessagesProps>((props:
8383
'text-xl text-bolt-elements-textSecondary hover:text-bolt-elements-textPrimary transition-colors',
8484
)}
8585
/>
86-
)}
87-
</WithTooltip>
86+
</WithTooltip>
87+
)}
8888

8989
<WithTooltip tooltip="Fork chat from this message">
9090
<button

app/components/settings/debug/DebugTab.tsx

Lines changed: 116 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ interface SystemInfo {
2222
timezone: string;
2323
memory: string;
2424
cores: number;
25+
deviceType: string;
26+
colorDepth: string;
27+
pixelRatio: number;
28+
online: boolean;
29+
cookiesEnabled: boolean;
30+
doNotTrack: boolean;
2531
}
2632

2733
interface IProviderConfig {
@@ -62,14 +68,100 @@ function getSystemInfo(): SystemInfo {
6268
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
6369
};
6470

71+
const getBrowserInfo = (): string => {
72+
const ua = navigator.userAgent;
73+
let browser = 'Unknown';
74+
75+
if (ua.includes('Firefox/')) {
76+
browser = 'Firefox';
77+
} else if (ua.includes('Chrome/')) {
78+
if (ua.includes('Edg/')) {
79+
browser = 'Edge';
80+
} else if (ua.includes('OPR/')) {
81+
browser = 'Opera';
82+
} else {
83+
browser = 'Chrome';
84+
}
85+
} else if (ua.includes('Safari/')) {
86+
if (!ua.includes('Chrome')) {
87+
browser = 'Safari';
88+
}
89+
}
90+
91+
// Extract version number
92+
const match = ua.match(new RegExp(`${browser}\\/([\\d.]+)`));
93+
const version = match ? ` ${match[1]}` : '';
94+
95+
return `${browser}${version}`;
96+
};
97+
98+
const getOperatingSystem = (): string => {
99+
const ua = navigator.userAgent;
100+
const platform = navigator.platform;
101+
102+
if (ua.includes('Win')) {
103+
return 'Windows';
104+
}
105+
106+
if (ua.includes('Mac')) {
107+
if (ua.includes('iPhone') || ua.includes('iPad')) {
108+
return 'iOS';
109+
}
110+
111+
return 'macOS';
112+
}
113+
114+
if (ua.includes('Linux')) {
115+
return 'Linux';
116+
}
117+
118+
if (ua.includes('Android')) {
119+
return 'Android';
120+
}
121+
122+
return platform || 'Unknown';
123+
};
124+
125+
const getDeviceType = (): string => {
126+
const ua = navigator.userAgent;
127+
128+
if (ua.includes('Mobile')) {
129+
return 'Mobile';
130+
}
131+
132+
if (ua.includes('Tablet')) {
133+
return 'Tablet';
134+
}
135+
136+
return 'Desktop';
137+
};
138+
139+
// Get more detailed memory info if available
140+
const getMemoryInfo = (): string => {
141+
if ('memory' in performance) {
142+
const memory = (performance as any).memory;
143+
return `${formatBytes(memory.jsHeapSizeLimit)} (Used: ${formatBytes(memory.usedJSHeapSize)})`;
144+
}
145+
146+
return 'Not available';
147+
};
148+
65149
return {
66-
os: navigator.platform,
67-
browser: navigator.userAgent.split(' ').slice(-1)[0],
150+
os: getOperatingSystem(),
151+
browser: getBrowserInfo(),
68152
screen: `${window.screen.width}x${window.screen.height}`,
69153
language: navigator.language,
70154
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
71-
memory: formatBytes(performance?.memory?.jsHeapSizeLimit || 0),
155+
memory: getMemoryInfo(),
72156
cores: navigator.hardwareConcurrency || 0,
157+
deviceType: getDeviceType(),
158+
159+
// Add new fields
160+
colorDepth: `${window.screen.colorDepth}-bit`,
161+
pixelRatio: window.devicePixelRatio,
162+
online: navigator.onLine,
163+
cookiesEnabled: navigator.cookieEnabled,
164+
doNotTrack: navigator.doNotTrack === '1',
73165
};
74166
}
75167

@@ -384,10 +476,31 @@ export default function DebugTab() {
384476
<p className="text-xs text-bolt-elements-textSecondary">Operating System</p>
385477
<p className="text-sm font-medium text-bolt-elements-textPrimary">{systemInfo.os}</p>
386478
</div>
479+
<div>
480+
<p className="text-xs text-bolt-elements-textSecondary">Device Type</p>
481+
<p className="text-sm font-medium text-bolt-elements-textPrimary">{systemInfo.deviceType}</p>
482+
</div>
387483
<div>
388484
<p className="text-xs text-bolt-elements-textSecondary">Browser</p>
389485
<p className="text-sm font-medium text-bolt-elements-textPrimary">{systemInfo.browser}</p>
390486
</div>
487+
<div>
488+
<p className="text-xs text-bolt-elements-textSecondary">Display</p>
489+
<p className="text-sm font-medium text-bolt-elements-textPrimary">
490+
{systemInfo.screen} ({systemInfo.colorDepth}) @{systemInfo.pixelRatio}x
491+
</p>
492+
</div>
493+
<div>
494+
<p className="text-xs text-bolt-elements-textSecondary">Connection</p>
495+
<p className="text-sm font-medium flex items-center gap-2">
496+
<span
497+
className={`inline-block w-2 h-2 rounded-full ${systemInfo.online ? 'bg-green-500' : 'bg-red-500'}`}
498+
/>
499+
<span className={`${systemInfo.online ? 'text-green-600' : 'text-red-600'}`}>
500+
{systemInfo.online ? 'Online' : 'Offline'}
501+
</span>
502+
</p>
503+
</div>
391504
<div>
392505
<p className="text-xs text-bolt-elements-textSecondary">Screen Resolution</p>
393506
<p className="text-sm font-medium text-bolt-elements-textPrimary">{systemInfo.screen}</p>

app/components/ui/IconButton.tsx

Lines changed: 41 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { memo } from 'react';
1+
import { memo, forwardRef, type ForwardedRef } from 'react';
22
import { classNames } from '~/utils/classNames';
33

44
type IconSize = 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
@@ -25,41 +25,48 @@ type IconButtonWithChildrenProps = {
2525

2626
type IconButtonProps = IconButtonWithoutChildrenProps | IconButtonWithChildrenProps;
2727

28+
// Componente IconButton com suporte a refs
2829
export const IconButton = memo(
29-
({
30-
icon,
31-
size = 'xl',
32-
className,
33-
iconClassName,
34-
disabledClassName,
35-
disabled = false,
36-
title,
37-
onClick,
38-
children,
39-
}: IconButtonProps) => {
40-
return (
41-
<button
42-
className={classNames(
43-
'flex items-center text-bolt-elements-item-contentDefault bg-transparent enabled:hover:text-bolt-elements-item-contentActive rounded-md p-1 enabled:hover:bg-bolt-elements-item-backgroundActive disabled:cursor-not-allowed',
44-
{
45-
[classNames('opacity-30', disabledClassName)]: disabled,
46-
},
47-
className,
48-
)}
49-
title={title}
50-
disabled={disabled}
51-
onClick={(event) => {
52-
if (disabled) {
53-
return;
54-
}
30+
forwardRef(
31+
(
32+
{
33+
icon,
34+
size = 'xl',
35+
className,
36+
iconClassName,
37+
disabledClassName,
38+
disabled = false,
39+
title,
40+
onClick,
41+
children,
42+
}: IconButtonProps,
43+
ref: ForwardedRef<HTMLButtonElement>,
44+
) => {
45+
return (
46+
<button
47+
ref={ref}
48+
className={classNames(
49+
'flex items-center text-bolt-elements-item-contentDefault bg-transparent enabled:hover:text-bolt-elements-item-contentActive rounded-md p-1 enabled:hover:bg-bolt-elements-item-backgroundActive disabled:cursor-not-allowed',
50+
{
51+
[classNames('opacity-30', disabledClassName)]: disabled,
52+
},
53+
className,
54+
)}
55+
title={title}
56+
disabled={disabled}
57+
onClick={(event) => {
58+
if (disabled) {
59+
return;
60+
}
5561

56-
onClick?.(event);
57-
}}
58-
>
59-
{children ? children : <div className={classNames(icon, getIconSize(size), iconClassName)}></div>}
60-
</button>
61-
);
62-
},
62+
onClick?.(event);
63+
}}
64+
>
65+
{children ? children : <div className={classNames(icon, getIconSize(size), iconClassName)}></div>}
66+
</button>
67+
);
68+
},
69+
),
6370
);
6471

6572
function getIconSize(size: IconSize) {

0 commit comments

Comments
 (0)