Merge remote-tracking branch 'origin/main' into pr-37

This commit is contained in:
sanio 2025-07-05 19:36:15 +09:00
commit 413ff96966
9 changed files with 246 additions and 70 deletions

View File

@ -97,6 +97,4 @@ We love contributions! Feel free to open issues for bugs or feature requests.
**Our mission is to build a living digital clone for everyone.** Glass is part of Step 1—a trusted pipeline that transforms your daily data into a scalable clone. Visit [pickle.com](https://pickle.com) to learn more. **Our mission is to build a living digital clone for everyone.** Glass is part of Step 1—a trusted pipeline that transforms your daily data into a scalable clone. Visit [pickle.com](https://pickle.com) to learn more.
## Star History ## Star History
[![Star History Chart](https://api.star-history.com/svg?repos=pickle-com/glass&type=Date)](https://www.star-history.com/#pickle-com/glass&Date)
<img src="./public/assets/star-history-202574.png">

View File

@ -8,29 +8,41 @@ productName: Glass
# Publish configuration for GitHub releases # Publish configuration for GitHub releases
publish: publish:
provider: github provider: github
owner: pickle-com owner: pickle-com
repo: glass repo: glass
releaseType: draft releaseType: draft
# List of files to be included in the app package # List of files to be included in the app package
files: files:
- src/**/* - src/**/*
- package.json - package.json
- pickleglass_web/backend_node/**/* - pickleglass_web/backend_node/**/*
- '!**/node_modules/electron/**' - '!**/node_modules/electron/**'
- public/build/**/* - public/build/**/*
# Additional resources to be copied into the app's resources directory # Additional resources to be copied into the app's resources directory
extraResources: extraResources:
- from: src/assets/SystemAudioDump - from: src/assets/SystemAudioDump
to: SystemAudioDump to: SystemAudioDump
- from: pickleglass_web/out - from: pickleglass_web/out
to: out to: out
# macOS specific configuration # macOS specific configuration
mac: mac:
# The application category type # The application category type
category: public.app-category.utilities category: public.app-category.utilities
# Path to the .icns icon file # Path to the .icns icon file
icon: src/assets/logo.icns icon: src/assets/logo.icns
# Target both Intel and Apple Silicon architectures
target:
- target: dmg
arch:
- x64
- arm64
- target: zip
arch:
- x64
- arm64
# Minimum macOS version (supports both Intel and Apple Silicon)
minimumSystemVersion: '11.0'

View File

@ -5,25 +5,26 @@ const { notarizeApp } = require('./notarize');
module.exports = { module.exports = {
packagerConfig: { packagerConfig: {
asar: { asar: {
unpack: unpack: '**/*.node,**/*.dylib,' + '**/node_modules/{sharp,@img}/**/*',
'**/*.node,**/*.dylib,' +
'**/node_modules/{sharp,@img}/**/*'
}, },
extraResource: ['./src/assets/SystemAudioDump', './pickleglass_web/out'], extraResource: ['./src/assets/SystemAudioDump', './pickleglass_web/out'],
name: 'Glass', name: 'Glass',
icon: 'src/assets/logo', icon: 'src/assets/logo',
appBundleId: 'com.pickle.glass', appBundleId: 'com.pickle.glass',
arch: 'universal',
protocols: [ protocols: [
{ {
name: 'PickleGlass Protocol', name: 'PickleGlass Protocol',
schemes: ['pickleglass'] schemes: ['pickleglass'],
} },
], ],
asarUnpack: [ asarUnpack: [
"**/*.node", '**/*.node',
"**/*.dylib", '**/*.dylib',
"node_modules/@img/sharp-darwin-arm64/**", 'node_modules/@img/sharp-darwin-x64/**',
"node_modules/@img/sharp-libvips-darwin-arm64/**" 'node_modules/@img/sharp-libvips-darwin-x64/**',
'node_modules/@img/sharp-darwin-arm64/**',
'node_modules/@img/sharp-libvips-darwin-arm64/**',
], ],
osxSign: { osxSign: {
identity: process.env.APPLE_SIGNING_IDENTITY, identity: process.env.APPLE_SIGNING_IDENTITY,
@ -35,8 +36,8 @@ module.exports = {
tool: 'notarytool', tool: 'notarytool',
appleId: process.env.APPLE_ID, appleId: process.env.APPLE_ID,
appleIdPassword: process.env.APPLE_ID_PASSWORD, appleIdPassword: process.env.APPLE_ID_PASSWORD,
teamId: process.env.APPLE_TEAM_ID teamId: process.env.APPLE_TEAM_ID,
} },
}, },
rebuildConfig: {}, rebuildConfig: {},
makers: [ makers: [

View File

@ -66,5 +66,9 @@
"electron-builder": "^26.0.12", "electron-builder": "^26.0.12",
"electron-reloader": "^1.2.3", "electron-reloader": "^1.2.3",
"esbuild": "^0.25.5" "esbuild": "^0.25.5"
},
"optionalDependencies": {
"@img/sharp-darwin-x64": "^0.34.2",
"@img/sharp-libvips-darwin-x64": "^1.1.0"
} }
} }

View File

@ -2,7 +2,7 @@
import { useState, useEffect, Suspense } from 'react' import { useState, useEffect, Suspense } from 'react'
import { useRedirectIfNotAuth } from '@/utils/auth' import { useRedirectIfNotAuth } from '@/utils/auth'
import { useSearchParams } from 'next/navigation' import { useSearchParams, useRouter } from 'next/navigation'
import Link from 'next/link' import Link from 'next/link'
import { import {
UserProfile, UserProfile,
@ -10,6 +10,7 @@ import {
Transcript, Transcript,
AiMessage, AiMessage,
getSessionDetails, getSessionDetails,
deleteSession,
} from '@/utils/api' } from '@/utils/api'
type ConversationItem = (Transcript & { type: 'transcript' }) | (AiMessage & { type: 'ai_message' }); type ConversationItem = (Transcript & { type: 'transcript' }) | (AiMessage & { type: 'ai_message' });
@ -29,6 +30,8 @@ function SessionDetailsContent() {
const [isLoading, setIsLoading] = useState(true); const [isLoading, setIsLoading] = useState(true);
const searchParams = useSearchParams(); const searchParams = useSearchParams();
const sessionId = searchParams.get('sessionId'); const sessionId = searchParams.get('sessionId');
const router = useRouter();
const [deleting, setDeleting] = useState(false);
useEffect(() => { useEffect(() => {
if (userInfo && sessionId) { if (userInfo && sessionId) {
@ -47,6 +50,20 @@ function SessionDetailsContent() {
} }
}, [userInfo, sessionId]); }, [userInfo, sessionId]);
const handleDelete = async () => {
if (!sessionId) return;
if (!window.confirm('Are you sure you want to delete this activity? This cannot be undone.')) return;
setDeleting(true);
try {
await deleteSession(sessionId);
router.push('/activity');
} catch (error) {
alert('Failed to delete activity.');
setDeleting(false);
console.error(error);
}
};
if (!userInfo || isLoading) { if (!userInfo || isLoading) {
return ( return (
<div className="min-h-screen bg-[#FDFCF9] flex items-center justify-center"> <div className="min-h-screen bg-[#FDFCF9] flex items-center justify-center">
@ -92,14 +109,23 @@ function SessionDetailsContent() {
</div> </div>
<div className="bg-white p-8 rounded-xl"> <div className="bg-white p-8 rounded-xl">
<div className="mb-6"> <div className="mb-6 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4">
<h1 className="text-2xl font-bold text-gray-900 mb-2"> <div>
{sessionDetails.session.title || `Conversation on ${new Date(sessionDetails.session.started_at * 1000).toLocaleDateString()}`} <h1 className="text-2xl font-bold text-gray-900 mb-2">
</h1> {sessionDetails.session.title || `Conversation on ${new Date(sessionDetails.session.started_at * 1000).toLocaleDateString()}`}
<div className="flex items-center text-sm text-gray-500 space-x-4"> </h1>
<span>{new Date(sessionDetails.session.started_at * 1000).toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' })}</span> <div className="flex items-center text-sm text-gray-500 space-x-4">
<span>{new Date(sessionDetails.session.started_at * 1000).toLocaleTimeString('en-US', { hour: 'numeric', minute: '2-digit', hour12: true })}</span> <span>{new Date(sessionDetails.session.started_at * 1000).toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' })}</span>
<span>{new Date(sessionDetails.session.started_at * 1000).toLocaleTimeString('en-US', { hour: 'numeric', minute: '2-digit', hour12: true })}</span>
</div>
</div> </div>
<button
onClick={handleDelete}
disabled={deleting}
className={`px-4 py-2 rounded text-sm font-medium border border-red-200 text-red-700 bg-red-50 hover:bg-red-100 transition-colors ${deleting ? 'opacity-50 cursor-not-allowed' : ''}`}
>
{deleting ? 'Deleting...' : 'Delete Activity'}
</button>
</div> </div>
{sessionDetails.summary && ( {sessionDetails.summary && (

View File

@ -7,12 +7,14 @@ import {
UserProfile, UserProfile,
Session, Session,
getSessions, getSessions,
deleteSession,
} from '@/utils/api' } from '@/utils/api'
export default function ActivityPage() { export default function ActivityPage() {
const userInfo = useRedirectIfNotAuth() as UserProfile | null; const userInfo = useRedirectIfNotAuth() as UserProfile | null;
const [sessions, setSessions] = useState<Session[]>([]) const [sessions, setSessions] = useState<Session[]>([])
const [isLoading, setIsLoading] = useState(true) const [isLoading, setIsLoading] = useState(true)
const [deletingId, setDeletingId] = useState<string | null>(null)
const fetchSessions = async () => { const fetchSessions = async () => {
try { try {
@ -47,6 +49,20 @@ export default function ActivityPage() {
return 'Good evening' return 'Good evening'
} }
const handleDelete = async (sessionId: string) => {
if (!window.confirm('Are you sure you want to delete this activity? This cannot be undone.')) return;
setDeletingId(sessionId);
try {
await deleteSession(sessionId);
setSessions(sessions => sessions.filter(s => s.id !== sessionId));
} catch (error) {
alert('Failed to delete activity.');
console.error(error);
} finally {
setDeletingId(null);
}
}
return ( return (
<div className="min-h-screen bg-gray-50"> <div className="min-h-screen bg-gray-50">
<div className="max-w-4xl mx-auto px-8 py-12"> <div className="max-w-4xl mx-auto px-8 py-12">
@ -67,17 +83,28 @@ export default function ActivityPage() {
) : sessions.length > 0 ? ( ) : sessions.length > 0 ? (
<div className="space-y-4"> <div className="space-y-4">
{sessions.map((session) => ( {sessions.map((session) => (
<Link href={`/activity/details?sessionId=${session.id}`} key={session.id} className="block bg-white rounded-lg p-6 shadow-sm border border-gray-200 hover:shadow-md transition-shadow cursor-pointer"> <div key={session.id} className="block bg-white rounded-lg p-6 shadow-sm border border-gray-200 hover:shadow-md transition-shadow cursor-pointer">
<div className="flex justify-between items-start mb-3"> <div className="flex justify-between items-start mb-3">
<h3 className="text-lg font-medium text-gray-900">{session.title || `Conversation - ${new Date(session.started_at * 1000).toLocaleDateString()}`}</h3> <div>
<span className="text-sm text-gray-500"> <Link href={`/activity/details?sessionId=${session.id}`} className="text-lg font-medium text-gray-900 hover:underline">
{new Date(session.started_at * 1000).toLocaleString()} {session.title || `Conversation - ${new Date(session.started_at * 1000).toLocaleDateString()}`}
</span> </Link>
<div className="text-sm text-gray-500">
{new Date(session.started_at * 1000).toLocaleString()}
</div>
</div>
<button
onClick={() => handleDelete(session.id)}
disabled={deletingId === session.id}
className={`ml-4 px-3 py-1 rounded text-xs font-medium border border-red-200 text-red-700 bg-red-50 hover:bg-red-100 transition-colors ${deletingId === session.id ? 'opacity-50 cursor-not-allowed' : ''}`}
>
{deletingId === session.id ? 'Deleting...' : 'Delete'}
</button>
</div> </div>
<span className="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800"> <span className="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800">
Conversation Conversation
</span> </span>
</Link> </div>
))} ))}
</div> </div>
) : ( ) : (

View File

@ -1,8 +1,8 @@
'use client' 'use client'
import { useState, useEffect } from 'react' import { useState, useEffect } from 'react'
import { ChevronDown } from 'lucide-react' import { ChevronDown, Plus, Copy } from 'lucide-react'
import { getPresets, updatePreset, PromptPreset } from '@/utils/api' import { getPresets, updatePreset, createPreset, PromptPreset } from '@/utils/api'
export default function PersonalizePage() { export default function PersonalizePage() {
const [allPresets, setAllPresets] = useState<PromptPreset[]>([]); const [allPresets, setAllPresets] = useState<PromptPreset[]>([]);
@ -72,7 +72,6 @@ export default function PersonalizePage() {
) )
); );
setIsDirty(false); setIsDirty(false);
console.log('Save completed!');
} catch (error) { } catch (error) {
console.error("Save failed:", error); console.error("Save failed:", error);
alert("Failed to save preset. See console for details."); alert("Failed to save preset. See console for details.");
@ -81,6 +80,73 @@ export default function PersonalizePage() {
} }
}; };
const handleCreateNewPreset = async () => {
const title = prompt("Enter a title for the new preset:");
if (!title) return;
try {
setSaving(true);
const { id } = await createPreset({
title,
prompt: "Enter your custom prompt here..."
});
const newPreset: PromptPreset = {
id,
uid: 'current_user',
title,
prompt: "Enter your custom prompt here...",
is_default: 0,
created_at: Date.now(),
sync_state: 'clean'
};
setAllPresets(prev => [...prev, newPreset]);
setSelectedPreset(newPreset);
setEditorContent(newPreset.prompt);
setIsDirty(false);
} catch (error) {
console.error("Failed to create preset:", error);
alert("Failed to create preset. See console for details.");
} finally {
setSaving(false);
}
};
const handleDuplicatePreset = async () => {
if (!selectedPreset) return;
const title = prompt("Enter a title for the duplicated preset:", `${selectedPreset.title} (Copy)`);
if (!title) return;
try {
setSaving(true);
const { id } = await createPreset({
title,
prompt: editorContent
});
const newPreset: PromptPreset = {
id,
uid: 'current_user',
title,
prompt: editorContent,
is_default: 0,
created_at: Date.now(),
sync_state: 'clean'
};
setAllPresets(prev => [...prev, newPreset]);
setSelectedPreset(newPreset);
setIsDirty(false);
} catch (error) {
console.error("Failed to duplicate preset:", error);
alert("Failed to duplicate preset. See console for details.");
} finally {
setSaving(false);
}
};
if (loading) { if (loading) {
return ( return (
<div className="flex items-center justify-center h-full"> <div className="flex items-center justify-center h-full">
@ -98,19 +164,39 @@ export default function PersonalizePage() {
<p className="text-sm text-gray-500 mb-2">Presets</p> <p className="text-sm text-gray-500 mb-2">Presets</p>
<h1 className="text-3xl font-bold text-gray-900">Personalize</h1> <h1 className="text-3xl font-bold text-gray-900">Personalize</h1>
</div> </div>
<button <div className="flex gap-2">
onClick={handleSave} <button
disabled={saving || !isDirty || selectedPreset?.is_default === 1} onClick={handleCreateNewPreset}
className={`px-4 py-2 rounded-md text-sm font-medium transition-all duration-200 ${ disabled={saving}
!isDirty && !saving className="px-4 py-2 rounded-md text-sm font-medium transition-all duration-200 bg-blue-600 text-white hover:bg-blue-700 disabled:bg-gray-400 disabled:cursor-not-allowed flex items-center gap-2"
? 'bg-gray-500 text-white cursor-default' >
: saving <Plus className="h-4 w-4" />
? 'bg-gray-400 text-white cursor-not-allowed' New Preset
: 'bg-gray-600 text-white hover:bg-gray-700' </button>
}`} {selectedPreset && (
> <button
{!isDirty && !saving ? 'Saved' : saving ? 'Saving...' : 'Save'} onClick={handleDuplicatePreset}
</button> disabled={saving}
className="px-4 py-2 rounded-md text-sm font-medium transition-all duration-200 bg-green-600 text-white hover:bg-green-700 disabled:bg-gray-400 disabled:cursor-not-allowed flex items-center gap-2"
>
<Copy className="h-4 w-4" />
Duplicate
</button>
)}
<button
onClick={handleSave}
disabled={saving || !isDirty || selectedPreset?.is_default === 1}
className={`px-4 py-2 rounded-md text-sm font-medium transition-all duration-200 ${
!isDirty && !saving
? 'bg-gray-500 text-white cursor-default'
: saving
? 'bg-gray-400 text-white cursor-not-allowed'
: 'bg-gray-600 text-white hover:bg-gray-700'
}`}
>
{!isDirty && !saving ? 'Saved' : saving ? 'Saving...' : 'Save'}
</button>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -137,13 +223,18 @@ export default function PersonalizePage() {
onClick={() => handlePresetClick(preset)} onClick={() => handlePresetClick(preset)}
className={` className={`
p-4 rounded-lg cursor-pointer transition-all duration-200 bg-white p-4 rounded-lg cursor-pointer transition-all duration-200 bg-white
h-48 flex flex-col shadow-sm hover:shadow-md h-48 flex flex-col shadow-sm hover:shadow-md relative
${selectedPreset?.id === preset.id ${selectedPreset?.id === preset.id
? 'border-2 border-blue-500 shadow-md' ? 'border-2 border-blue-500 shadow-md'
: 'border border-gray-200 hover:border-gray-300' : 'border border-gray-200 hover:border-gray-300'
} }
`} `}
> >
{preset.is_default === 1 && (
<div className="absolute top-2 right-2 bg-yellow-100 text-yellow-800 text-xs px-2 py-1 rounded-full">
Default
</div>
)}
<h3 className="font-semibold text-gray-900 mb-3 text-center text-sm"> <h3 className="font-semibold text-gray-900 mb-3 text-center text-sm">
{preset.title} {preset.title}
</h3> </h3>
@ -158,12 +249,24 @@ export default function PersonalizePage() {
</div> </div>
<div className="flex-1 bg-white"> <div className="flex-1 bg-white">
<div className="h-full px-8 py-6"> <div className="h-full px-8 py-6 flex flex-col">
{selectedPreset?.is_default === 1 && (
<div className="mb-4 p-4 bg-yellow-50 border border-yellow-200 rounded-lg">
<div className="flex items-center gap-2">
<div className="w-4 h-4 bg-yellow-400 rounded-full"></div>
<p className="text-sm text-yellow-800">
<strong>This is a default preset and cannot be edited.</strong>
Use the "Duplicate" button above to create an editable copy, or create a new preset.
</p>
</div>
</div>
)}
<textarea <textarea
value={editorContent} value={editorContent}
onChange={handleEditorChange} onChange={handleEditorChange}
className="w-full h-full text-sm text-gray-900 border-0 resize-none focus:outline-none bg-transparent font-mono leading-relaxed" className="w-full flex-1 text-sm text-gray-900 border-0 resize-none focus:outline-none bg-transparent font-mono leading-relaxed"
placeholder="Select a preset or type directly..." placeholder="Select a preset or type directly..."
readOnly={selectedPreset?.is_default === 1}
/> />
</div> </div>
</div> </div>

View File

@ -542,7 +542,10 @@ export const updatePreset = async (id: string, data: { title: string, prompt: st
method: 'PUT', method: 'PUT',
body: JSON.stringify(data), body: JSON.stringify(data),
}); });
if (!response.ok) throw new Error('Failed to update preset'); if (!response.ok) {
const errorText = await response.text();
throw new Error(`Failed to update preset: ${response.status} ${errorText}`);
}
} }
}; };

View File

@ -524,6 +524,8 @@ async function saveConversationTurn(speaker, transcription) {
} }
async function initializeLiveSummarySession(language = 'en') { async function initializeLiveSummarySession(language = 'en') {
// Use system environment variable if set, otherwise use the provided language
const effectiveLanguage = process.env.OPENAI_TRANSCRIBE_LANG || language || 'en';
if (isInitializingSession) { if (isInitializingSession) {
console.log('Session initialization already in progress.'); console.log('Session initialization already in progress.');
return false; return false;
@ -620,7 +622,7 @@ async function initializeLiveSummarySession(language = 'en') {
}; };
const mySttConfig = { const mySttConfig = {
language: language, language: effectiveLanguage,
callbacks: { callbacks: {
onmessage: handleMyMessage, onmessage: handleMyMessage,
onerror: error => console.error('My STT session error:', error.message), onerror: error => console.error('My STT session error:', error.message),
@ -628,7 +630,7 @@ async function initializeLiveSummarySession(language = 'en') {
}, },
}; };
const theirSttConfig = { const theirSttConfig = {
language: language, language: effectiveLanguage,
callbacks: { callbacks: {
onmessage: handleTheirMessage, onmessage: handleTheirMessage,
onerror: error => console.error('Their STT session error:', error.message), onerror: error => console.error('Their STT session error:', error.message),