Skip to content

Commit

Permalink
update model
Browse files Browse the repository at this point in the history
  • Loading branch information
leokwsw committed Nov 17, 2024
1 parent db76df3 commit 5c9f918
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 30 deletions.
59 changes: 39 additions & 20 deletions api/chatgpt/typings.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,41 @@ type UserLogin struct {
}

type CreateConversationRequest struct {
Action string `json:"action"`
ConversationID string `json:"conversation_id,omitempty"`
ConversationMode ConvMode `json:"conversation_mode"`
ForceNulligen bool `json:"force_nulligen"`
ForceParagen bool `json:"force_paragen"`
ForceParagenModelSlug string `json:"force_paragen_model_slug"`
ForceRateLimit bool `json:"force_rate_limit"`
ForceUseSse bool `json:"force_use_sse"`
HistoryAndTrainingDisabled bool `json:"history_and_training_disabled"`
Messages []Message `json:"messages"`
Model string `json:"model"`
ParentMessageID string `json:"parent_message_id"`
ResetRateLimits bool `json:"reset_rate_limits"`
Suggestions []string `json:"suggestions"`
TimezoneOffsetMin int `json:"timezone_offset_min"`
VariantPurpose string `json:"variant_purpose"`
WebSocketRequestId string `json:"websocket_request_id"`
Action string `json:"action"`
ClientContextualInfo ClientContextualInfo `json:"client_contextual_info"`
ConversationMode ConvMode `json:"conversation_mode"`
ConversationID string `json:"conversation_id,omitempty"`
ConversationOrigin string `json:"conversation_origin,omitempty"`
ForceNulligen bool `json:"force_nulligen"`
ForceParagen bool `json:"force_paragen"`
ForceParagenModelSlug string `json:"force_paragen_model_slug"`
ForceRateLimit bool `json:"force_rate_limit"`
ForceUseSse bool `json:"force_use_sse"`
HistoryAndTrainingDisabled bool `json:"history_and_training_disabled"`
Messages []Message `json:"messages"`
ParagenCotSummaryDisplayOverride string `json:"paragen_cot_summary_display_override"`
ParagenStreamTypeOverride string `json:"paragen_stream_type_override,omitempty"`
Model string `json:"model"`
ParentMessageID string `json:"parent_message_id"`
ResetRateLimits bool `json:"reset_rate_limits"`
Suggestions []string `json:"suggestions"`
SupportedEncodings []string `json:"supported_encodings"`
SupportBuffering string `json:"supports_buffering"`
SystemHints []string `json:"system_hints"`
Timezone string `json:"timezone"`
TimezoneOffsetMin int `json:"timezone_offset_min"`
VariantPurpose string `json:"variant_purpose"`
WebSocketRequestId string `json:"websocket_request_id"`
}

type ClientContextualInfo struct {
IsDarkMode bool `json:"is_dark_mode"`
PageHeight int `json:"page_height"`
PageWidth int `json:"page_width"`
PixelRation int `json:"pixel_ration"`
ScreenHeight int `json:"screen_height"`
ScreenWidth int `json:"screen_width"`
TimeSinceLoaded int `json:"time_since_loaded"`
}

type ConvMode struct {
Expand All @@ -42,9 +60,10 @@ type ConversationMode struct {
type Message struct {
Author Author `json:"author"`
//Role string `json:"role"`
Content Content `json:"content"`
ID string `json:"id"`
Metadata interface{} `json:"metadata"`
Content Content `json:"content"`
CreateTime int `json:"create_time"`
ID string `json:"id"`
Metadata interface{} `json:"metadata"`
}

type MessageMetadata struct {
Expand Down
52 changes: 42 additions & 10 deletions example/freeChatgpt.http
Original file line number Diff line number Diff line change
@@ -1,30 +1,62 @@
### create conversation
#POST {{baseUrl}}/chatgpt/backend-api/conversation
#POST {{baseUrl}}/chatgpt/conversation
POST {{baseUrl}}/api/conversation
#POST {{baseUrl}}/api/conversation
POST https://chatgpt-proxy.leonardpark.dev/api/conversation
Content-Type: application/json
Accept: text/event-stream

{
"action": "next",
"conversation_mode": {
"kind": "primary_assistant"
},
"variant_purpose": "none",
"messages": [
{
"id": "{{$random.uuid}}",
"id": "aaa27a3c-e498-4fe5-ab1c-1b60e433f190",
"author": {
"role": "user"
},
"content": {
"content_type": "text",
"parts": [
"Hello"
"Give me some news about HK"
]
}
},
"metadata": {
"serialization_metadata": {
"custom_symbol_offsets": []
}
},
"create_time": 1731865506.298
}
],
"model": "text-davinci-002-render-sha",
"timezone_offset_min": -480
"parent_message_id": "",
"model": "auto",
"timezone_offset_min": -480,
"timezone": "Asia/Hong_Kong",
"suggestions": [],
"history_and_training_disabled": false,
"conversation_mode": {
"kind": "primary_assistant"
},
"force_paragen": false,
"force_paragen_model_slug": "",
"force_rate_limit": false,
"reset_rate_limits": false,
"websocket_request_id": "",
"system_hints": [],
"supported_encodings": [
"v1"
],
"conversation_origin": null,
"client_contextual_info": {
"is_dark_mode": true,
"time_since_loaded": 65,
"page_height": 968,
"page_width": 888,
"pixel_ratio": 1,
"screen_height": 1080,
"screen_width": 1920
},
"paragen_stream_type_override": null,
"paragen_cot_summary_display_override": "allow",
"supports_buffering": true
}

0 comments on commit 5c9f918

Please sign in to comment.