@@ -14,73 +14,49 @@ type Turn struct {
1414 StartTime time.Time `json:"startTime"`
1515}
1616
17- type Payload struct {
18- Time int64 `json:"time,omitempty"`
19- Type string `json:"type,omitempty"`
20- Payload interface {} `json:"payload,omitempty"`
17+ // GetTranscriptResponse is the wrapper for the v1 get-transcript API response.
18+ type GetTranscriptResponse struct {
19+ Transcript TranscriptDetail `json:"transcript"`
2120}
2221
23- type BlockPayload struct {
24- BlockID string `json:"blockID"`
22+ // TranscriptDetail contains the transcript data from the v1 API.
23+ type TranscriptDetail struct {
24+ ID string `json:"id"`
25+ SessionID string `json:"sessionID"`
26+ ProjectID string `json:"projectID"`
27+ EnvironmentID string `json:"environmentID"`
28+ CreatedAt string `json:"createdAt"`
29+ UpdatedAt string `json:"updatedAt"`
30+ Logs []Log `json:"logs"`
2531}
2632
27- type FlowPayload struct {
28- DiagramID string `json:"diagramID"`
33+ // Log represents a single log entry in the v1 transcript response.
34+ type Log struct {
35+ Type string `json:"type"`
36+ Data json.RawMessage `json:"data"`
37+ CreatedAt string `json:"createdAt"`
38+ UpdatedAt string `json:"updatedAt"`
2939}
3040
31- type DebugPayload struct {
32- Type string `json:"type,omitempty"`
33- Message string `json:"message"`
34- }
35-
36- type TextPayload struct {
37- Slate Slate `json:"slate"`
38- Message string `json:"message"`
39- Delay int `json:"delay"`
40- AI bool `json:"ai"`
41+ // LogData is used to partially parse the Data field of a Log entry.
42+ type LogData struct {
43+ Type string `json:"type"`
44+ Payload json.RawMessage `json:"payload,omitempty"`
4145}
4246
43- type Slate struct {
44- ID string `json:"id"`
45- Content []Content `json:"content"`
46- MessageDelayMilliseconds int `json:"messageDelayMilliseconds"`
47- }
48-
49- type Content struct {
50- Children []Children `json:"children"`
51- }
52-
53- type Children struct {
54- Text string `json:"text"`
47+ type Payload struct {
48+ Time int64 `json:"time,omitempty"`
49+ Type string `json:"type,omitempty"`
50+ Payload interface {} `json:"payload,omitempty"`
5551}
5652
57- type RequestPayload struct {
58- Type string `json:"type"`
59- Payload IntentPayload `json:"payload"`
53+ type TextPayload struct {
54+ Message string `json:"message"`
6055}
6156
6257type IntentPayload struct {
63- Query string `json:"query"`
64- Intent Intent `json:"intent"`
65- Entities []interface {} `json:"entities"`
66- Confidence float64 `json:"confidence"`
67- }
68-
69- type Intent struct {
70- Name string `json:"name"`
71- }
72-
73- type AIResponseParameters struct {
74- System string `json:"system"`
75- Assistant string `json:"assistant"`
76- Output string `json:"output"`
77- Model string `json:"model"`
78- Temperature float64 `json:"temperature"`
79- MaxTokens int `json:"maxTokens"`
80- QueryTokens int `json:"queryTokens"`
81- AnswerTokens int `json:"answerTokens"`
82- Tokens int `json:"tokens"`
83- Multiplier float64 `json:"multiplier"`
58+ Query string `json:"query"`
59+ Confidence float64 `json:"confidence"`
8460}
8561
8662// GetTextPayload extracts TextPayload from generic Payload
@@ -104,26 +80,7 @@ func (p Payload) GetTextPayload() (*TextPayload, error) {
10480 return & textPayload , nil
10581}
10682
107- func (p Payload ) GetRequestPayload () (* RequestPayload , error ) {
108- // Modified condition to accept both "request" and "intent" types
109- if p .Type != "request" {
110- return nil , fmt .Errorf ("payload type is not 'request' or 'intent', got: %s" , p .Type )
111- }
112-
113- payloadBytes , err := json .Marshal (p .Payload )
114- if err != nil {
115- return nil , fmt .Errorf ("failed to marshal request payload: %w" , err )
116- }
117-
118- var requestPayload RequestPayload
119- if err := json .Unmarshal (payloadBytes , & requestPayload ); err != nil {
120- return nil , fmt .Errorf ("failed to unmarshal request payload: %w" , err )
121- }
122-
123- return & requestPayload , nil
124- }
125-
126- // Add GetIntentPayload method
83+ // GetIntentPayload extracts IntentPayload from generic Payload
12784func (p Payload ) GetIntentPayload () (* IntentPayload , error ) {
12885 if p .Type != "intent" {
12986 return nil , fmt .Errorf ("payload type is not 'intent', got: %s" , p .Type )
0 commit comments