Hold Chat Operator
Overview
Section titled “Overview”The Hold Chat LOP conditionally holds or passes incoming chat messages based on the state of its Hold
parameter. If Hold
is on, messages are queued internally. When Hold
is turned off, all queued messages are released sequentially.
Requirements
Section titled “Requirements”- Python Packages:
tiktoken
(for token counting). Install via ChatTD Python manager.
- ChatTD Operator: Required and must be configured.
Input/Output
Section titled “Input/Output”Inputs
Section titled “Inputs”- Input Conversation (Table DAT): Table with conversation data. Columns:
role
,message
,id
,timestamp
.
Outputs
Section titled “Outputs”- Output Conversation (Table DAT): Table containing messages released when the hold is inactive.
Parameters
Section titled “Parameters”Hold Page
Section titled “Hold Page” Hold Active (Holdactive)
op('hold_chat').par.Holdactive
Toggle - Default:
Off
Toggle Manual Hold (Manualhold)
op('hold_chat').par.Manualhold
Toggle - Default:
Off
Manual Hold (Userhold)
op('hold_chat').par.Userhold
Toggle - Default:
Off
Enable Token Hold (Enabletokenhold)
op('hold_chat').par.Enabletokenhold
Toggle - Default:
Off
Token Hold Threshold (Tokenholdthreshold)
op('hold_chat').par.Tokenholdthreshold
Integer - Default:
None
Token Total (Tokentotal)
op('hold_chat').par.Tokentotal
Integer - Default:
0
Token Hold Active (Tokenhold)
op('hold_chat').par.Tokenhold
Toggle - Default:
Off
Enable Message Hold (Enablemessagehold)
op('hold_chat').par.Enablemessagehold
Toggle - Default:
Off
Message Hold Threshold (Messageholdthreshold)
op('hold_chat').par.Messageholdthreshold
Integer - Default:
None
Message Total (Messagetotal)
op('hold_chat').par.Messagetotal
Integer - Default:
-1
Message Hold Active (Messagehold)
op('hold_chat').par.Messagehold
Toggle - Default:
Off
Lock When Held & Unlock (Lockwhenheld)
op('hold_chat').par.Lockwhenheld
Toggle - Default:
Off
Callbacks Page
Section titled “Callbacks Page” Callbacks Header
Callback DAT (Callbackdat)
op('hold_chat').par.Callbackdat
DAT - Default:
None
Edit Callbacks (Editcallbacksscript)
op('hold_chat').par.Editcallbacksscript
Pulse - Default:
None
Create Callbacks (Createpulse)
op('hold_chat').par.Createpulse
Pulse - Default:
None
onHold (Onhold)
op('hold_chat').par.Onhold
Toggle - Default:
On
onHoldEnd (Onholdend)
op('hold_chat').par.Onholdend
Toggle - Default:
On
onTokenThreshold (Ontokenthreshold)
op('hold_chat').par.Ontokenthreshold
Toggle - Default:
Off
onTokenThresholdEnd (Ontokenthresholdend)
op('hold_chat').par.Ontokenthresholdend
Toggle - Default:
Off
onMessageThreshold (Onmessagethreshold)
op('hold_chat').par.Onmessagethreshold
Toggle - Default:
Off
onMessageThresholdEnd (Onmessagethresholdend)
op('hold_chat').par.Onmessagethresholdend
Toggle - Default:
Off
onManual (Onmanual)
op('hold_chat').par.Onmanual
Toggle - Default:
Off
onManualEnd (Onmanualend)
op('hold_chat').par.Onmanualend
Toggle - Default:
Off
About Page
Section titled “About Page” Bypass (Bypass)
op('hold_chat').par.Bypass
Toggle - Default:
Off
Version (Version)
op('hold_chat').par.Version
String - Default:
1.0.0
Last Updated (Lastupdated)
op('hold_chat').par.Lastupdated
String - Default:
2024-11-10
Show Built In Pars (Showbuiltin)
op('hold_chat').par.Showbuiltin
Toggle - Default:
Off
Creator (Creator)
op('hold_chat').par.Creator
String - Default:
dotsimulate
Website (Website)
op('hold_chat').par.Website
String - Default:
https://dotsimulate.com
ChatTD Operator (Chattd)
op('hold_chat').par.Chattd
OP - Default:
/dot_lops/ChatTD
Callbacks
Section titled “Callbacks” Available Callbacks:
onHold
onHoldEnd
onTokenThreshold
onTokenThresholdEnd
onMessageThreshold
onMessageThresholdEnd
onManual
onManualEnd
Example Callback Structure:
def onHold(info):
# Called when any hold (manual, token, message) becomes active
# info contains details like op, holdType ('manual', 'token', 'message')
print(f"Hold activated: {info.get('holdType')}")
pass
def onHoldEnd(info):
# Called when all holds become inactive
print("Hold ended")
pass
def onTokenThreshold(info):
# Called when token count exceeds threshold
print(f"Token threshold exceeded: {info.get('tokenCount')}")
pass
def onTokenThresholdEnd(info):
# Called when token count drops below threshold
print(f"Token count below threshold: {info.get('tokenCount')}")
pass
def onMessageThreshold(info):
# Called when message count exceeds threshold
print(f"Message threshold exceeded: {info.get('messageCount')}")
pass
def onMessageThresholdEnd(info):
# Called when message count drops below threshold
print(f"Message count below threshold: {info.get('messageCount')}")
pass
def onManual(info):
# Called when manual hold is activated
print("Manual hold activated")
pass
def onManualEnd(info):
# Called when manual hold is deactivated
print("Manual hold deactivated")
pass
Performance Considerations
Section titled “Performance Considerations”tiktoken
counting can be intensive with high message volume.Lock When Held & Unlock
can save resources while held.- Optimize callback script efficiency.
Usage Examples
Section titled “Usage Examples”Token-Based Hold
Section titled “Token-Based Hold”hold_op = op('hold_chat1')conv_dat = op('conversation_log')
hold_op.inputConnectors[0].connect(conv_dat)hold_op.par.Enabletokenhold = 1hold_op.par.Tokenholdthreshold = 2048
# Hold activates automatically when conv_dat token count > 2048# Output DAT will be empty while hold is active
Manual Moderation Hold
Section titled “Manual Moderation Hold”hold_op = op('hold_chat1')
# To activate manual hold:hold_op.par.Manualhold = 1
# To release manual hold:hold_op.par.Manualhold = 0
Common Use Cases
Section titled “Common Use Cases”- Rate limiting chat messages.
- Manual content moderation queues.
- Implementing “slow modes”.
- Managing API costs based on token limits.