Skip to content

Commit 0b6cac0

Browse files
Fix/connector (#572)
* fix twitter color on dark mode to be black bg with white text * invalidate chat so its refetch even if user is on it when notification comes * add flag to hide onboarding, holons, tasks and connectors * add privacy page, remove notion link * skip anonymize download if no-op * enable features on dev * enable on dev, disable on prod, add voice feature dsiabling, inject in go server
1 parent c82667d commit 0b6cac0

File tree

10 files changed

+47
-23
lines changed

10 files changed

+47
-23
lines changed

.github/workflows/dev-release.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,11 @@ jobs:
104104
USE_LOCAL_EMBEDDINGS: 'true'
105105
TTS_ENDPOINT: 'https://inference.tinfoil.sh/v1/audio/speech'
106106
BUILD_CHANNEL: 'dev'
107-
VITE_DISABLE_ONBOARDING: 'true'
108-
VITE_DISABLE_HOLONS: 'true'
109-
VITE_DISABLE_TASKS: 'true'
110-
VITE_DISABLE_CONNECTORS: 'true'
107+
VITE_DISABLE_ONBOARDING: 'false'
108+
VITE_DISABLE_HOLONS: 'false'
109+
VITE_DISABLE_TASKS: 'false'
110+
VITE_DISABLE_CONNECTORS: 'false'
111+
VITE_DISABLE_VOICE: 'false'
111112

112113
run: make build-dev-mac-silicon
113114

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ jobs:
110110
VITE_DISABLE_HOLONS: 'true'
111111
VITE_DISABLE_TASKS: 'true'
112112
VITE_DISABLE_CONNECTORS: 'true'
113+
VITE_DISABLE_VOICE: 'true'
113114

114115
run: make build-mac-silicon
115116

app/src/main/goServer.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,12 @@ async function startGoServer(
100100
PROXY_TEE_URL: process.env.PROXY_TEE_URL,
101101
HOLON_API_URL: process.env.HOLON_API_URL,
102102
ANONYMIZER_TYPE: process.env.ANONYMIZER_TYPE,
103-
USE_LOCAL_EMBEDDINGS: process.env.USE_LOCAL_EMBEDDINGS
103+
USE_LOCAL_EMBEDDINGS: process.env.USE_LOCAL_EMBEDDINGS,
104+
DISABLE_ONBOARDING: process.env.VITE_DISABLE_ONBOARDING,
105+
DISABLE_HOLONS: process.env.VITE_DISABLE_HOLONS,
106+
DISABLE_TASKS: process.env.VITE_DISABLE_TASKS,
107+
DISABLE_CONNECTORS: process.env.VITE_DISABLE_CONNECTORS,
108+
DISABLE_VOICE: process.env.VITE_DISABLE_VOICE
104109
}
105110
})
106111

app/src/main/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ log.info(`Running in ${IS_PRODUCTION ? 'production' : 'development'} mode`)
4040
declare const __APP_ENV__: Record<string, string>
4141

4242
for (const [key, val] of Object.entries(typeof __APP_ENV__ === 'object' ? __APP_ENV__ : {})) {
43-
if (!(key in process.env) && (key.startsWith('TTS') || key.startsWith('STT'))) {
43+
if (
44+
!(key in process.env) &&
45+
(key.startsWith('TTS') || key.startsWith('STT') || key.startsWith('VITE_'))
46+
) {
4447
process.env[key] = val
4548
}
4649
}

app/src/renderer/src/components/chat/ChatHome.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { ChatHomeHeader } from './ChatHomeHeader'
1717
import { ChatHomeSuggestions } from './ChatHomeSuggestions'
1818
import { Suggestion } from './ChatHomeSuggestions'
1919
import { ConnectSourcesButton } from '../data-sources/ConnectButton'
20+
import { checkConnectorsDisabled } from '@renderer/lib/utils'
2021

2122
interface IndexRouteSearch {
2223
focusInput?: string
@@ -28,6 +29,7 @@ export function Home() {
2829
})
2930
const { isVoiceMode, startVoiceMode } = useVoiceStore()
3031
const { isVoiceReady } = useDependencyStatus()
32+
const isConnectorsDisabled = checkConnectorsDisabled()
3133

3234
const navigate = useNavigate()
3335
const router = useRouter()
@@ -276,14 +278,16 @@ export function Home() {
276278
handleSuggestionClick={handleSuggestionClick}
277279
/>
278280
</div>
279-
<motion.div
280-
initial={{ opacity: 0, y: 10 }}
281-
animate={{ opacity: showSuggestions ? 1 : 0, y: showSuggestions ? 0 : 10 }}
282-
transition={{ type: 'spring', stiffness: 150, damping: 15, delay: 0.5 }}
283-
className="flex justify-center absolute bottom-0 left-0 right-0 p-4"
284-
>
285-
<ConnectSourcesButton />
286-
</motion.div>
281+
{!isConnectorsDisabled && (
282+
<motion.div
283+
initial={{ opacity: 0, y: 10 }}
284+
animate={{ opacity: showSuggestions ? 1 : 0, y: showSuggestions ? 0 : 10 }}
285+
transition={{ type: 'spring', stiffness: 150, damping: 15, delay: 0.5 }}
286+
className="flex justify-center absolute bottom-0 left-0 right-0 p-4"
287+
>
288+
<ConnectSourcesButton />
289+
</motion.div>
290+
)}
287291
</motion.div>
288292
)
289293
}

app/src/renderer/src/components/chat/ChatInputBox.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Tooltip } from '../ui/tooltip'
55
import { AnimatePresence, motion } from 'framer-motion'
66
import { Button } from '../ui/button'
77
import { AudioLinesIcon, Brain, CheckIcon, X } from 'lucide-react'
8-
import { cn } from '@renderer/lib/utils'
8+
import { checkVoiceDisabled, cn } from '@renderer/lib/utils'
99
import { SendButton } from './MessageInput'
1010
import { toast } from 'sonner'
1111
import { Popover, PopoverContent, PopoverTrigger } from '../ui/popover'
@@ -37,6 +37,8 @@ export default function ChatInputBox({
3737
onVoiceModeChange,
3838
onLayoutAnimationComplete
3939
}: ChatInputBoxProps) {
40+
const isVoiceDisabled = checkVoiceDisabled()
41+
4042
// Auto-resize textarea fallback for browsers without field-sizing support
4143
useEffect(() => {
4244
if (!textareaRef.current) return
@@ -139,7 +141,7 @@ export default function ChatInputBox({
139141
/>
140142
</motion.div>
141143
)}
142-
{!isVoiceMode && query.length === 0 ? (
144+
{!isVoiceMode && query.length === 0 && !isVoiceDisabled ? (
143145
<motion.div
144146
key="talk"
145147
layout="position"

app/src/renderer/src/components/chat/ChatView.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { Fade } from '../ui/blur-fade'
1414
import Error from './Error'
1515
import { AnonToggleButton } from './AnonToggleButton'
1616
import { usePrevious } from '@renderer/lib/hooks/usePrevious'
17+
import { checkVoiceDisabled } from '@renderer/lib/utils'
1718

1819
interface ChatViewProps {
1920
chat: Chat
@@ -28,6 +29,8 @@ export default function ChatView({ chat }: ChatViewProps) {
2829
const [showScrollToBottom, setShowScrollToBottom] = useState(false)
2930
const [isAnonymized, setIsAnonymized] = useState(false)
3031

32+
const isVoiceDisabled = checkVoiceDisabled()
33+
3134
const {
3235
privacyDict,
3336
messages,
@@ -74,7 +77,7 @@ export default function ChatView({ chat }: ChatViewProps) {
7477
}
7578
}
7679

77-
if (isVoiceMode) {
80+
if (isVoiceMode && !isVoiceDisabled) {
7881
return (
7982
<VoiceModeChatView
8083
chat={chat}

app/src/renderer/src/components/chat/MessageInput.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useState, useEffect, useRef, useLayoutEffect } from 'react'
22
import { Button } from '../ui/button'
33
import { ArrowUp, X } from 'lucide-react'
44
import { motion, AnimatePresence } from 'framer-motion'
5-
import { cn } from '../../lib/utils'
5+
import { checkVoiceDisabled, cn } from '../../lib/utils'
66

77
import { EnableVoiceModeButton, ReasoningButton } from './ChatInputBox'
88
import useDependencyStatus from '@renderer/hooks/useDependencyStatus'
@@ -145,6 +145,7 @@ export function SendButton({
145145
type?: 'button' | 'submit' | 'reset'
146146
}) {
147147
const [prevWaitingState, setPrevWaitingState] = useState(false)
148+
const isVoiceDisabled = checkVoiceDisabled()
148149

149150
useEffect(() => {
150151
if (!isWaitingTwinResponse && prevWaitingState) {
@@ -160,7 +161,7 @@ export function SendButton({
160161

161162
return (
162163
<>
163-
{!isWaitingForAgent && !text.trim() ? (
164+
{!isWaitingForAgent && !text.trim() && !isVoiceDisabled ? (
164165
<EnableVoiceModeButton onClick={() => onVoiceModeChange?.()} isVoiceReady={isVoiceReady} />
165166
) : (
166167
<Button
@@ -169,7 +170,7 @@ export function SendButton({
169170
variant={isWaitingForAgent ? 'destructive' : 'default'}
170171
className={cn('rounded-full transition-all duration-200 ease-in-out relative', className)}
171172
onClick={isWaitingForAgent ? handleStop : onSend}
172-
disabled={isStreamingResponse}
173+
disabled={isStreamingResponse || !text.trim()}
173174
>
174175
<AnimatePresence mode="wait">
175176
{isWaitingForAgent ? (

app/src/renderer/src/components/onboarding/new/OnboardingContainer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { useOnboardingStore } from '@renderer/lib/stores/onboarding'
55
import { useVoiceStore } from '@renderer/lib/stores/voice'
66
import useMicrophonePermission from '@renderer/hooks/useMicrophonePermission'
77
import EnableMicrophone from './EnableMicrophone'
8-
import { checkVoiceDisabled } from '@renderer/lib/utils'
8+
import { checkOnboardingDisabled } from '@renderer/lib/utils'
99

1010
import VoiceOnboarding from './VoiceOnboarding'
1111
import TTSOnboarding from './TTSOnboarding'
@@ -19,7 +19,7 @@ export default function OnboardingContainer() {
1919
const { microphoneStatus } = useMicrophonePermission()
2020
const [onboardingType, setOnboardingType] = useState<OnboardingType>('VOICE')
2121

22-
const isOnboardingDisabled = checkVoiceDisabled()
22+
const isOnboardingDisabled = checkOnboardingDisabled()
2323

2424
useEffect(() => {
2525
if (isCompleted || isOnboardingDisabled) {

app/src/renderer/src/lib/utils.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export function getMockFrequencyData(): Uint8Array {
3232
return freqData
3333
}
3434

35-
export const checkVoiceDisabled = (): boolean => {
35+
export const checkOnboardingDisabled = (): boolean => {
3636
return import.meta.env.VITE_DISABLE_ONBOARDING === 'true'
3737
}
3838

@@ -47,3 +47,7 @@ export const checkTasksDisabled = (): boolean => {
4747
export const checkConnectorsDisabled = (): boolean => {
4848
return import.meta.env.VITE_DISABLE_CONNECTORS === 'true'
4949
}
50+
51+
export const checkVoiceDisabled = (): boolean => {
52+
return import.meta.env.VITE_DISABLE_VOICE === 'true'
53+
}

0 commit comments

Comments
 (0)