From 5c9f918621fea7e3afe44d50e78f146a73429c02 Mon Sep 17 00:00:00 2001 From: Leo Wu Date: Mon, 18 Nov 2024 01:54:49 +0800 Subject: [PATCH] update model --- api/chatgpt/typings.go | 59 ++++++++++++++++++++++++++-------------- example/freeChatgpt.http | 52 ++++++++++++++++++++++++++++------- 2 files changed, 81 insertions(+), 30 deletions(-) diff --git a/api/chatgpt/typings.go b/api/chatgpt/typings.go index 1a2f9a17..b9d57096 100644 --- a/api/chatgpt/typings.go +++ b/api/chatgpt/typings.go @@ -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 { @@ -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 { diff --git a/example/freeChatgpt.http b/example/freeChatgpt.http index 5592413e..8cd13ec7 100644 --- a/example/freeChatgpt.http +++ b/example/freeChatgpt.http @@ -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 } \ No newline at end of file