u
This commit is contained in:
@@ -77,6 +77,8 @@ const initialState = {
|
||||
selectedConversationId: null,
|
||||
/** First-open draft: no server conversation yet, created on first send. */
|
||||
draftConversation: false,
|
||||
/** Prefilled input text waiting to be consumed by the chat UI. */
|
||||
pendingInput: null,
|
||||
conversationState: 'idle',
|
||||
provider: 'openrouter',
|
||||
model: DEFAULT_MODEL,
|
||||
@@ -270,6 +272,33 @@ const actions = {
|
||||
void chatAutomat.actions.loadConversations();
|
||||
},
|
||||
|
||||
/**
|
||||
* Open the chat drawer with a fresh draft conversation and prefilled prompt.
|
||||
* @param {string} [prompt='']
|
||||
*/
|
||||
openWithPrompt(prompt = '') {
|
||||
chatOpenedThisSession = true;
|
||||
closeConversationStream();
|
||||
chatAutomat.setState({
|
||||
isOpen: true,
|
||||
sseEstablished: true,
|
||||
draftConversation: true,
|
||||
selectedConversationId: null,
|
||||
provider: 'openrouter',
|
||||
model: DEFAULT_MODEL,
|
||||
messages: [],
|
||||
conversationState: 'idle',
|
||||
streamPhase: 'idle',
|
||||
streamingText: '',
|
||||
lastUsage: null,
|
||||
activeTurns: [],
|
||||
sendError: null,
|
||||
pendingInput: prompt,
|
||||
});
|
||||
ensureCompanyEventsConnected();
|
||||
void chatAutomat.actions.loadConversations();
|
||||
},
|
||||
|
||||
/**
|
||||
* Start an implicit new conversation with the first preset model. Nothing is
|
||||
* created on the server until the first message is sent.
|
||||
|
||||
Reference in New Issue
Block a user