forked from maxduke/go-chatgpt-api
-
Notifications
You must be signed in to change notification settings - Fork 1
/
typings.txt
155 lines (140 loc) · 4.99 KB
/
typings.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
package chatgpt
import (
"github.com/google/uuid"
)
type CreateConversationRequest struct {
Action string `json:"action"`
Messages []Message `json:"messages,omitempty"`
Model string `json:"model"`
ParentMessageID string `json:"parent_message_id,omitempty"`
ConversationID string `json:"conversation_id,omitempty"`
TimezoneOffsetMin int `json:"timezone_offset_min"`
ForceUseSse bool `json:"force_use_sse"`
HistoryAndTrainingDisabled bool `json:"history_and_training_disabled"`
AutoContinue bool `json:"auto_continue"`
Suggestions []string `json:"suggestions"`
WebsocketRequestId string `json:"websocket_request_id"`
Conversation_mode interface{} `json:"conversation_mode,omitempty"`
PluginIDs []string `json:"plugin_ids,omitempty"`
PluginData interface{} `json:"plugin_data,omitempty"`
Force_nulligen bool `json:"force_nulligen,omitempty"`
Force_paragen bool `json:"force_paragen,omitempty"`
Force_paragen_model_slug string `json:"force_paragen_model_slug,omitempty"`
Force_rate_limit bool `json:"force_rate_limit,omitempty"`
}
func (c *CreateConversationRequest) AddMessage(role string, content string) {
c.Messages = append(c.Messages, Message{
ID: uuid.New().String(),
Author: Author{Role: role},
Content: Content{ContentType: "text", Parts: []interface{}{content}},
Metadata: map[string]string{},
})
}
type Message struct {
Author Author `json:"author"`
Content Content `json:"content"`
ID string `json:"id"`
Metadata interface{} `json:"metadata"`
}
type Author struct {
Role string `json:"role"`
Nane interface{} `json:"name,omitempty"`
Metadata interface{} `json:"metadata,omitempty"`
}
type Content struct {
ContentType string `json:"content_type"`
Parts []interface{} `json:"parts"`
}
type CreateConversationResponse struct {
Message struct {
ID string `json:"id"`
Author struct {
Role string `json:"role"`
Name interface{} `json:"name"`
Metadata struct {
} `json:"metadata"`
} `json:"author"`
CreateTime float64 `json:"create_time"`
UpdateTime interface{} `json:"update_time"`
Content struct {
ContentType string `json:"content_type"`
Parts []string `json:"parts"`
} `json:"content"`
Status string `json:"status"`
EndTurn bool `json:"end_turn"`
Weight float64 `json:"weight"`
Metadata struct {
MessageType string `json:"message_type"`
ModelSlug string `json:"model_slug"`
FinishDetails struct {
Type string `json:"type"`
} `json:"finish_details"`
} `json:"metadata"`
Recipient string `json:"recipient"`
} `json:"message"`
ConversationID string `json:"conversation_id"`
Error interface{} `json:"error"`
}
type GetModelsResponse struct {
Models []struct {
Slug string `json:"slug"`
MaxTokens int `json:"max_tokens"`
Title string `json:"title"`
Description string `json:"description"`
Tags []string `json:"tags"`
Capabilities struct {
} `json:"capabilities"`
EnabledTools []string `json:"enabled_tools,omitempty"`
} `json:"models"`
Categories []struct {
Category string `json:"category"`
HumanCategoryName string `json:"human_category_name"`
SubscriptionLevel string `json:"subscription_level"`
DefaultModel string `json:"default_model"`
CodeInterpreterModel string `json:"code_interpreter_model"`
PluginsModel string `json:"plugins_model"`
} `json:"categories"`
}
type ChatGPTWSSResponse struct {
WssUrl string `json:"wss_url"`
ConversationId string `json:"conversation_id,omitempty"`
ResponseId string `json:"response_id,omitempty"`
}
type WSSMsgResponse struct {
SequenceId int `json:"sequenceId"`
Type string `json:"type"`
From string `json:"from"`
DataType string `json:"dataType"`
Data WSSMsgResponseData `json:"data"`
}
type WSSSequenceAckMessage struct {
Type string `json:"type"`
SequenceId int `json:"sequenceId"`
}
type WSSMsgResponseData struct {
Type string `json:"type"`
Body string `json:"body"`
MoreBody bool `json:"more_body"`
ResponseId string `json:"response_id"`
ConversationId string `json:"conversation_id"`
}
type ChatRequire struct {
Token string `json:"token"`
Proof ProofWork `json:"proofofwork,omitempty"`
Arkose struct {
Required bool `json:"required"`
DX string `json:"dx,omitempty"`
} `json:"arkose"`
}
type FileInfo struct {
DownloadURL string `json:"download_url"`
Status string `json:"status"`
}
type DalleContent struct {
AssetPointer string `json:"asset_pointer"`
Metadata struct {
Dalle struct {
Prompt string `json:"prompt"`
} `json:"dalle"`
} `json:"metadata"`
}