feat: cancel auto-start feishu bot
Browse files- src/hooks/useFeishuBridge.ts +0 -14
src/hooks/useFeishuBridge.ts
CHANGED
|
@@ -25,25 +25,11 @@ type ActiveFeishuTurn = {
|
|
| 25 |
const FEISHU_CHANNEL_SERVER = 'feishu'
|
| 26 |
|
| 27 |
export function useFeishuBridge({ messages, isLoading }: Props): void {
|
| 28 |
-
const autoStartAttemptedRef = useRef(false)
|
| 29 |
const pendingInboundRef = useRef<{ chatId: string }[]>([])
|
| 30 |
const activeTurnRef = useRef<ActiveFeishuTurn | null>(null)
|
| 31 |
const lastProcessedMessageCountRef = useRef(messages.length)
|
| 32 |
const previousLoadingRef = useRef(isLoading)
|
| 33 |
|
| 34 |
-
// Auto-start if configured
|
| 35 |
-
useEffect(() => {
|
| 36 |
-
if (autoStartAttemptedRef.current) return
|
| 37 |
-
autoStartAttemptedRef.current = true
|
| 38 |
-
|
| 39 |
-
const config = getFeishuConfig()
|
| 40 |
-
if (!config.appId || !config.appSecret) return
|
| 41 |
-
|
| 42 |
-
void feishuService.startFromSavedConfig().catch(e => {
|
| 43 |
-
console.warn('[feishu] auto-start failed:', e instanceof Error ? e.message : String(e))
|
| 44 |
-
})
|
| 45 |
-
}, [])
|
| 46 |
-
|
| 47 |
// Subscribe to inbound events (stores chatId for turn tracking)
|
| 48 |
useEffect(() => {
|
| 49 |
return feishuService.subscribeToInbound(event => {
|
|
|
|
| 25 |
const FEISHU_CHANNEL_SERVER = 'feishu'
|
| 26 |
|
| 27 |
export function useFeishuBridge({ messages, isLoading }: Props): void {
|
|
|
|
| 28 |
const pendingInboundRef = useRef<{ chatId: string }[]>([])
|
| 29 |
const activeTurnRef = useRef<ActiveFeishuTurn | null>(null)
|
| 30 |
const lastProcessedMessageCountRef = useRef(messages.length)
|
| 31 |
const previousLoadingRef = useRef(isLoading)
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
// Subscribe to inbound events (stores chatId for turn tracking)
|
| 34 |
useEffect(() => {
|
| 35 |
return feishuService.subscribeToInbound(event => {
|