Skip to content

Commit

Permalink
Merge pull request #112 from handsome0hell/docker
Browse files Browse the repository at this point in the history
fix: tls_client for ChatGPT
  • Loading branch information
F33RNI authored Dec 19, 2023
2 parents 72570a2 + 8993ed4 commit e4f142b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:
with:
flavor: latest=auto
tags: |
type=edge
type=edge,branch=next
type=ref,event=branch
type=ref,event=tag
type=semver,pattern={{version}}
Expand Down
10 changes: 5 additions & 5 deletions ChatGPTModule.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import os.path
import time
import uuid
from revChatGPT.V1 import Chatbot as V1Chatbot
from revChatGPT.V3 import Chatbot as V3Chatbot
from typing import List, Dict

import BotHandler
Expand Down Expand Up @@ -79,13 +81,11 @@ def initialize(self, proxy=None) -> None:
if self.config["chatgpt"]["base_url"]:
os.environ["CHATGPT_BASE_URL"] = self.config["chatgpt"]["base_url"]

from revChatGPT.V1 import Chatbot
self._chatbot = Chatbot(config=self._get_chatbot_config(proxy))
self._chatbot = V1Chatbot(config=self._get_chatbot_config(proxy))

# API type 3
elif self.config["chatgpt"]["api_type"] == 3:
logging.info("Initializing ChatGPT module with API type 3")
from revChatGPT.V3 import Chatbot
engine = str(self.config["chatgpt"]["engine"])

# Check proxy
Expand All @@ -94,11 +94,11 @@ def initialize(self, proxy=None) -> None:

# Initialize chatbot
if len(engine) > 0:
self._chatbot = Chatbot(str(self.config["chatgpt"]["api_key"]),
self._chatbot = V3Chatbot(str(self.config["chatgpt"]["api_key"]),
proxy=proxy,
engine=engine)
else:
self._chatbot = Chatbot(str(self.config["chatgpt"]["api_key"]),
self._chatbot = V3Chatbot(str(self.config["chatgpt"]["api_key"]),
proxy=proxy)

# Wrong API type
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ RUN --mount=type=bind,from=build,source=/wheels,target=/wheels pip install --no-
WORKDIR /src
RUN --mount=type=bind,source=. \
pyinstaller --specpath /app --distpath /app/dist --workpath /app/work \
--collect-all tls_client --collect-all tiktoken_ext.openai_public \
--onefile --name main main.py

# Build application image
Expand Down

0 comments on commit e4f142b

Please sign in to comment.