mirror of
https://github.com/mudler/LocalAI.git
synced 2026-02-21 10:49:01 -06:00
fix(realtime): Add transcription session created event, match OpenAI behavior (#6445)
Signed-off-by: Richard Palethorpe <io@richiejp.com>
This commit is contained in:
committed by
GitHub
parent
af31a77061
commit
0529c7d0a0
@@ -256,21 +256,13 @@ func registerRealtime(application *application.Application) func(c *websocket.Co
|
||||
sessions[sessionID] = session
|
||||
sessionLock.Unlock()
|
||||
|
||||
// Send session.created and conversation.created events to the client
|
||||
sendEvent(c, types.SessionCreatedEvent{
|
||||
sendEvent(c, types.TranscriptionSessionCreatedEvent{
|
||||
ServerEventBase: types.ServerEventBase{
|
||||
EventID: "event_TODO",
|
||||
Type: types.ServerEventTypeSessionCreated,
|
||||
Type: types.ServerEventTypeTranscriptionSessionCreated,
|
||||
},
|
||||
Session: session.ToServer(),
|
||||
})
|
||||
sendEvent(c, types.ConversationCreatedEvent{
|
||||
ServerEventBase: types.ServerEventBase{
|
||||
EventID: "event_TODO",
|
||||
Type: types.ServerEventTypeConversationCreated,
|
||||
},
|
||||
Conversation: conversation.ToServer(),
|
||||
})
|
||||
|
||||
var (
|
||||
// mt int
|
||||
|
||||
@@ -704,6 +704,7 @@ const (
|
||||
ServerEventTypeError ServerEventType = "error"
|
||||
ServerEventTypeSessionCreated ServerEventType = "session.created"
|
||||
ServerEventTypeSessionUpdated ServerEventType = "session.updated"
|
||||
ServerEventTypeTranscriptionSessionCreated ServerEventType = "transcription_session.created"
|
||||
ServerEventTypeTranscriptionSessionUpdated ServerEventType = "transcription_session.updated"
|
||||
ServerEventTypeConversationCreated ServerEventType = "conversation.created"
|
||||
ServerEventTypeInputAudioBufferCommitted ServerEventType = "input_audio_buffer.committed"
|
||||
@@ -767,6 +768,15 @@ type SessionCreatedEvent struct {
|
||||
Session ServerSession `json:"session"`
|
||||
}
|
||||
|
||||
// TranscriptionSessionCreatedEvent is the event for session created.
|
||||
// Returned when a transcription session is created.
|
||||
// See https://platform.openai.com/docs/api-reference/realtime-server-events/session/created
|
||||
type TranscriptionSessionCreatedEvent struct {
|
||||
ServerEventBase
|
||||
// The transcription session resource.
|
||||
Session ServerSession `json:"session"`
|
||||
}
|
||||
|
||||
// SessionUpdatedEvent is the event for session updated.
|
||||
// Returned when a session is updated.
|
||||
// See https://platform.openai.com/docs/api-reference/realtime-server-events/session/updated
|
||||
|
||||
Reference in New Issue
Block a user