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.
## Star History
<img src="./public/assets/star-history-202574.png">
[![Star History Chart](https://api.star-history.com/svg?repos=pickle-com/glass&type=Date)](https://www.star-history.com/#pickle-com/glass&Date)

View File

@ -8,29 +8,41 @@ productName: Glass
# Publish configuration for GitHub releases
publish:
provider: github
owner: pickle-com
repo: glass
releaseType: draft
provider: github
owner: pickle-com
repo: glass
releaseType: draft
# List of files to be included in the app package
files:
- src/**/*
- package.json
- pickleglass_web/backend_node/**/*
- '!**/node_modules/electron/**'
- public/build/**/*
- src/**/*
- package.json
- pickleglass_web/backend_node/**/*
- '!**/node_modules/electron/**'
- public/build/**/*
# Additional resources to be copied into the app's resources directory
extraResources:
- from: src/assets/SystemAudioDump
to: SystemAudioDump
- from: pickleglass_web/out
to: out
- from: src/assets/SystemAudioDump
to: SystemAudioDump
- from: pickleglass_web/out
to: out
# macOS specific configuration
mac:
# The application category type
category: public.app-category.utilities
# Path to the .icns icon file
icon: src/assets/logo.icns
# The application category type
category: public.app-category.utilities
# Path to the .icns icon file
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 = {
packagerConfig: {
asar: {
unpack:
'**/*.node,**/*.dylib,' +
'**/node_modules/{sharp,@img}/**/*'
unpack: '**/*.node,**/*.dylib,' + '**/node_modules/{sharp,@img}/**/*',
},
extraResource: ['./src/assets/SystemAudioDump', './pickleglass_web/out'],
name: 'Glass',
icon: 'src/assets/logo',
appBundleId: 'com.pickle.glass',
arch: 'universal',
protocols: [
{
name: 'PickleGlass Protocol',
schemes: ['pickleglass']
}
schemes: ['pickleglass'],
},
],
asarUnpack: [
"**/*.node",
"**/*.dylib",
"node_modules/@img/sharp-darwin-arm64/**",
"node_modules/@img/sharp-libvips-darwin-arm64/**"
'**/*.node',
'**/*.dylib',
'node_modules/@img/sharp-darwin-x64/**',
'node_modules/@img/sharp-libvips-darwin-x64/**',
'node_modules/@img/sharp-darwin-arm64/**',
'node_modules/@img/sharp-libvips-darwin-arm64/**',
],
osxSign: {
identity: process.env.APPLE_SIGNING_IDENTITY,
@ -35,8 +36,8 @@ module.exports = {
tool: 'notarytool',
appleId: process.env.APPLE_ID,
appleIdPassword: process.env.APPLE_ID_PASSWORD,
teamId: process.env.APPLE_TEAM_ID
}
teamId: process.env.APPLE_TEAM_ID,
},
},
rebuildConfig: {},
makers: [

View File

@ -66,5 +66,9 @@
"electron-builder": "^26.0.12",
"electron-reloader": "^1.2.3",
"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 { useRedirectIfNotAuth } from '@/utils/auth'
import { useSearchParams } from 'next/navigation'
import { useSearchParams, useRouter } from 'next/navigation'
import Link from 'next/link'
import {
UserProfile,
@ -10,6 +10,7 @@ import {
Transcript,
AiMessage,
getSessionDetails,
deleteSession,
} from '@/utils/api'
type ConversationItem = (Transcript & { type: 'transcript' }) | (AiMessage & { type: 'ai_message' });
@ -29,6 +30,8 @@ function SessionDetailsContent() {
const [isLoading, setIsLoading] = useState(true);
const searchParams = useSearchParams();
const sessionId = searchParams.get('sessionId');
const router = useRouter();
const [deleting, setDeleting] = useState(false);
useEffect(() => {
if (userInfo && sessionId) {
@ -47,6 +50,20 @@ function SessionDetailsContent() {
}
}, [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) {
return (
<div className="min-h-screen bg-[#FDFCF9] flex items-center justify-center">
@ -92,14 +109,23 @@ function SessionDetailsContent() {
</div>
<div className="bg-white p-8 rounded-xl">
<div className="mb-6">
<h1 className="text-2xl font-bold text-gray-900 mb-2">
{sessionDetails.session.title || `Conversation on ${new Date(sessionDetails.session.started_at * 1000).toLocaleDateString()}`}
</h1>
<div className="flex items-center text-sm text-gray-500 space-x-4">
<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 className="mb-6 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4">
<div>
<h1 className="text-2xl font-bold text-gray-900 mb-2">
{sessionDetails.session.title || `Conversation on ${new Date(sessionDetails.session.started_at * 1000).toLocaleDateString()}`}
</h1>
<div className="flex items-center text-sm text-gray-500 space-x-4">
<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>
<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>
{sessionDetails.summary && (

View File

@ -7,12 +7,14 @@ import {
UserProfile,
Session,
getSessions,
deleteSession,
} from '@/utils/api'
export default function ActivityPage() {
const userInfo = useRedirectIfNotAuth() as UserProfile | null;
const [sessions, setSessions] = useState<Session[]>([])
const [isLoading, setIsLoading] = useState(true)
const [deletingId, setDeletingId] = useState<string | null>(null)
const fetchSessions = async () => {
try {
@ -47,6 +49,20 @@ export default function ActivityPage() {
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 (
<div className="min-h-screen bg-gray-50">
<div className="max-w-4xl mx-auto px-8 py-12">
@ -67,17 +83,28 @@ export default function ActivityPage() {
) : sessions.length > 0 ? (
<div className="space-y-4">
{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">
<h3 className="text-lg font-medium text-gray-900">{session.title || `Conversation - ${new Date(session.started_at * 1000).toLocaleDateString()}`}</h3>
<span className="text-sm text-gray-500">
{new Date(session.started_at * 1000).toLocaleString()}
</span>
<div>
<Link href={`/activity/details?sessionId=${session.id}`} className="text-lg font-medium text-gray-900 hover:underline">
{session.title || `Conversation - ${new Date(session.started_at * 1000).toLocaleDateString()}`}
</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>
<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
</span>
</Link>
<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
</span>
</div>
))}
</div>
) : (

View File

@ -1,8 +1,8 @@
'use client'
import { useState, useEffect } from 'react'
import { ChevronDown } from 'lucide-react'
import { getPresets, updatePreset, PromptPreset } from '@/utils/api'
import { ChevronDown, Plus, Copy } from 'lucide-react'
import { getPresets, updatePreset, createPreset, PromptPreset } from '@/utils/api'
export default function PersonalizePage() {
const [allPresets, setAllPresets] = useState<PromptPreset[]>([]);
@ -72,7 +72,6 @@ export default function PersonalizePage() {
)
);
setIsDirty(false);
console.log('Save completed!');
} catch (error) {
console.error("Save failed:", error);
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) {
return (
<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>
<h1 className="text-3xl font-bold text-gray-900">Personalize</h1>
</div>
<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 className="flex gap-2">
<button
onClick={handleCreateNewPreset}
disabled={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"
>
<Plus className="h-4 w-4" />
New Preset
</button>
{selectedPreset && (
<button
onClick={handleDuplicatePreset}
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>
@ -137,13 +223,18 @@ export default function PersonalizePage() {
onClick={() => handlePresetClick(preset)}
className={`
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
? 'border-2 border-blue-500 shadow-md'
: '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">
{preset.title}
</h3>
@ -158,12 +249,24 @@ export default function PersonalizePage() {
</div>
<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
value={editorContent}
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..."
readOnly={selectedPreset?.is_default === 1}
/>
</div>
</div>

View File

@ -542,7 +542,10 @@ export const updatePreset = async (id: string, data: { title: string, prompt: st
method: 'PUT',
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') {
// Use system environment variable if set, otherwise use the provided language
const effectiveLanguage = process.env.OPENAI_TRANSCRIBE_LANG || language || 'en';
if (isInitializingSession) {
console.log('Session initialization already in progress.');
return false;
@ -620,7 +622,7 @@ async function initializeLiveSummarySession(language = 'en') {
};
const mySttConfig = {
language: language,
language: effectiveLanguage,
callbacks: {
onmessage: handleMyMessage,
onerror: error => console.error('My STT session error:', error.message),
@ -628,7 +630,7 @@ async function initializeLiveSummarySession(language = 'en') {
},
};
const theirSttConfig = {
language: language,
language: effectiveLanguage,
callbacks: {
onmessage: handleTheirMessage,
onerror: error => console.error('Their STT session error:', error.message),