feat: Twitter Spaces Integration #1550
Open
+1,306
−70
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Relates to:
No specific issue linked. This PR addresses new community-driven features.
Risks
Low. Existing users who relied on Deepgram by default will still see no change unless they explicitly define a new
TRANSCRIPTION_PROVIDER
. Fallback logic preserves original behavior (Deepgram → OpenAI → Local).Background
What does this PR do?
TRANSCRIPTION_PROVIDER
setting (deepgram
,openai
, orlocal
) with fallback logic.agent-twitter-client
into this repo for better flexibility and less friction in plugin development.maxSpeakers
).Flow Recap
Periodic Check
shouldLaunchSpace()
(random chance, business hours, cooldown).manageCurrentSpace()
handles speaker timeouts, occupancy updates, queue acceptance, etc.Space Creation
SpaceConfig
(topics from config or GPT).speakerRequest
,occupancyUpdate
,idleTimeout
, etc.Speaker Logic
activeSpeakers
array + a queue if at capacity (maxSpeakers
).speakerMaxDurationMs
per speaker.Stopping
stopSpace()
finalizes the Space, logs completion, clears states, etc.Configuration
A)
.env
/ Environment VariablesB)
character.json
→"twitterSpaces"
FieldmaxSpeakers
: number of concurrent speakers allowed.topics
: if none are provided, GPT generates them dynamically.randomChance
: probability for each check cycle to spawn a new Space.speakerMaxDurationMs
: maximum time each speaker can speak before removal.What kind of change is this?
Documentation changes needed?
Yes, minimal. We must mention:
TRANSCRIPTION_PROVIDER
in.env
(optional).twitterSpaces
config section incharacter.json
.Testing
Where should a reviewer start?
transcription.service.ts
to review the fallback logic.Detailed testing steps
TRANSCRIPTION_PROVIDER
in.env
(or leave it empty to keep old fallback).deepgram
oropenai
.twitterSpaces.randomChance
in character json to 1 (for 100% rate of starting a space)No special database migrations are needed. Basic local runs and logs confirm correct functioning.
Future Improvements