Skip to content

Commit d28dc75

Browse files
authored
Merge pull request #191 from yjg30737/Dev
v1.8.0
2 parents 1f32376 + 200f8f3 commit d28dc75

36 files changed

+723
-1116
lines changed

MANIFEST.in

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
include pyqt_openai/ico/*
22
include pyqt_openai/prompt_res/*
33
include pyqt_openai/lang/*
4+
include pyqt_openai/img/*
45

56
include pyqt_openai/icon.ico

pyproject.toml

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "pyqt-openai"
7-
version = "1.7.1"
7+
version = "1.8.0"
88
description = "Python multipurpose chatbot that user can use GPT, other AI models altogether (Release Name: VividNode)"
99
authors = [{ name = "Jung Gyu Yoon", email = "yjg30737@gmail.com" }]
1010
license = { text = "MIT" }
@@ -21,9 +21,12 @@ dependencies = [
2121
"openai",
2222
"anthropic",
2323
"google-generativeai",
24-
"llama-index",
2524
"replicate",
2625

26+
"llama-index",
27+
"docx2txt",
28+
"openpyxl",
29+
2730
"g4f",
2831
"curl_cffi",
2932
"litellm",

pyqt_openai/__init__.py

+22-40
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
# For the sake of following the PEP8 standard, we will declare module-level dunder names.
2424
# PEP8 standard about dunder names: https://peps.python.org/pep-0008/#module-level-dunder-names
2525

26-
__version__ = "1.7.1"
26+
__version__ = "1.8.0"
2727
__author__ = "Jung Gyu Yoon"
2828

2929
# Constants
@@ -129,6 +129,8 @@ def move_bin(filename, dst_dir):
129129
"https://github.com/yjg30737/pyqt-openai?tab=readme-ov-file#troubleshooting"
130130
)
131131

132+
AWESOME_CHATGPT_PROMPTS_URL = "https://huggingface.co/datasets/fka/awesome-chatgpt-prompts/tree/main"
133+
132134
COLUMN_TO_EXCLUDE_FROM_SHOW_HIDE_CHAT = ["id"]
133135
COLUMN_TO_EXCLUDE_FROM_SHOW_HIDE_IMAGE = ["id", "data"]
134136
DEFAULT_LANGUAGE = "en_US"
@@ -206,6 +208,11 @@ def move_bin(filename, dst_dir):
206208
ICON_REALTIME_API = os.path.join(ICON_PATH, "realtime_api.svg")
207209
ICON_FILE = os.path.join(ICON_PATH, "file.svg")
208210

211+
## IMAGE
212+
IMAGE_PATH = os.path.join(EXEC_PATH, "img")
213+
214+
IMAGE_IMPORT_PROMPT_WITH_CSV_RIGHT_FORM = os.path.join(IMAGE_PATH, "import_prompt_with_csv_right_form.png")
215+
209216
## CUSTOMIZE
210217
DEFAULT_ICON_SIZE = (24, 24)
211218
DEFAULT_USER_IMAGE_PATH = ICON_USER
@@ -228,6 +235,8 @@ def move_bin(filename, dst_dir):
228235
DEFAULT_TOAST_BACKGROUND_COLOR = "#444444"
229236
DEFAULT_TOAST_FOREGROUND_COLOR = "#EEEEEE"
230237

238+
DEFAULT_WARNING_COLOR = "#FFA500"
239+
231240
## MARKDOWN
232241
# I am not planning to use it at the moment.
233242
# DEFAULT_MARKDOWN_span_font = 'Courier New'
@@ -297,6 +306,7 @@ def move_bin(filename, dst_dir):
297306
IMAGE_FILE_EXT_LIST_STR = "Image File (*.png *.jpg *.jpeg *.gif *.bmp)"
298307
TEXT_FILE_EXT_LIST_STR = "Text File (*.txt)"
299308
JSON_FILE_EXT_LIST_STR = "JSON File (*.json)"
309+
CSV_FILE_EXT_LIST_STR = "CSV File (*.csv)"
300310
READ_FILE_EXT_LIST_STR = f"{TEXT_FILE_EXT_LIST_STR};;{IMAGE_FILE_EXT_LIST_STR}"
301311

302312
## PROMPT
@@ -391,40 +401,15 @@ def move_bin(filename, dst_dir):
391401

392402
STT_MODEL = "whisper-1"
393403

394-
# Endpoint
395-
# https://platform.openai.com/docs/models/model-endpoint-compatibility
396-
OPENAI_ENDPOINT_DICT = {
397-
"/v1/chat/completions": ["gpt-4o", "gpt-4o-mini", "o1-preview", "o1-mini"],
398-
"/v1/completions": [
399-
"text-davinci-003",
400-
"text-davinci-002",
401-
"text-curie-001",
402-
"text-babbage-001",
403-
"text-ada-001",
404-
"davinci",
405-
"curie",
406-
"babbage",
407-
"ada",
408-
],
409-
"/v1/edits": ["text-davinci-edit-001", "code-davinci-edit-001"],
410-
"/v1/audio/transcriptions": ["whisper-1"],
411-
"/v1/audio/translations": ["whisper-1"],
412-
"/v1/fine-tunes": ["davinci", "curie", "babbage", "ada"],
413-
"/v1/embeddings": ["text-embedding-ada-002", "text-search-ada-doc-001"],
414-
"/vi/moderations": ["text-moderation-stable", "text-moderation-latest"],
415-
}
416-
417404
DEFAULT_TOKEN_CHUNK_SIZE = 1024
418405

419406
# This doesn't need endpoint
420-
DALLE_ARR = ["dall-e-2", "dall-e-3"]
407+
OPENAI_DEFAULT_IMAGE_MODEL = "dall-e-3"
421408

422409
DEFAULT_DATETIME_FORMAT = "%Y-%m-%d %H:%M:%S"
423410

424-
OPENAI_CHAT_ENDPOINT = "/v1/chat/completions"
425-
426-
# Other models' configuration data
427-
DEFAULT_GEMINI_MODEL = "gemini/gemini-1.5-flash"
411+
# This has to be managed separately since some of the arguments are different with usual models
412+
O1_MODELS = ["o1-preview", "o1-mini"]
428413

429414
# Overall API configuration data
430415
DEFAULT_API_CONFIGS = [
@@ -434,6 +419,7 @@ def move_bin(filename, dst_dir):
434419
"env_var_name": "OPENAI_API_KEY",
435420
"api_key": "",
436421
"manual_url": HOW_TO_GET_OPENAI_API_KEY_URL,
422+
"model_list": ["gpt-4o", "gpt-4o-mini"] + O1_MODELS
437423
},
438424
# Azure
439425
{
@@ -493,13 +479,15 @@ def move_bin(filename, dst_dir):
493479
"api_key": "",
494480
"manual_url": HOW_TO_GET_GEMINI_API_KEY_URL,
495481
"prefix": "gemini",
482+
"model_list": ["gemini/gemini-1.5-flash", "gemini/gemini-1.5-pro"]
496483
},
497484
# Anthropic
498485
{
499486
"display_name": "Anthropic",
500487
"env_var_name": "ANTHROPIC_API_KEY",
501488
"api_key": "",
502489
"manual_url": HOW_TO_GET_CLAUDE_API_KEY_URL,
490+
"model_list": ["claude-3-haiku-20240307", "claude-3-5-sonnet-20240620"]
503491
},
504492
# AWS Sagemaker
505493
{
@@ -903,10 +891,6 @@ def move_bin(filename, dst_dir):
903891
},
904892
]
905893

906-
907-
# This has to be managed separately since some of the arguments are different with usual models
908-
O1_MODELS = ["o1-preview", "o1-mini"]
909-
910894
DEFAULT_LLM = "gpt-4o"
911895

912896
G4F_PROVIDER_DEFAULT = "Auto"
@@ -915,17 +899,14 @@ def move_bin(filename, dst_dir):
915899

916900
G4F_DEFAULT_IMAGE_MODEL = "flux"
917901

918-
# Dictionary that stores the platform and model pairs
919-
PROVIDER_MODEL_DICT = {
920-
"OpenAI": ["gpt-4o", "gpt-4o-mini"] + O1_MODELS,
921-
"Gemini": ["gemini/gemini-1.5-flash", "gemini/gemini-1.5-pro"],
922-
"Anthropic": ["claude-3-5-sonnet-20240620"],
923-
}
924-
925902
# Constants related to the number of messages LLM will store
926903
MAXIMUM_MESSAGES_IN_PARAMETER = 40
927904
MAXIMUM_MESSAGES_IN_PARAMETER_RANGE = 2, 1000
928905

906+
# llamaIndex
907+
LLAMA_INDEX_DEFAULT_SUPPORTED_FORMATS_LIST = ['.txt']
908+
LLAMA_INDEX_DEFAULT_ALL_SUPPORTED_FORMATS_LIST = ['.txt', '.docx', '.hwp', '.ipynb', '.csv', '.jpeg', '.jpg', '.mbox', '.md', '.mp3', '.mp4', '.pdf', '.png', '.ppt', '.pptx', '.pptm']
909+
929910
# PROMPT
930911
## DEFAULT JSON FILENAME FOR PROMPT
931912
AWESOME_CHATGPT_PROMPTS_FILENAME = "prompt_res/awesome_chatgpt_prompts.json"
@@ -1165,6 +1146,7 @@ def move_bin(filename, dst_dir):
11651146
# Llama Index
11661147
"use_llama_index": False,
11671148
"llama_index_directory": "",
1149+
"llama_index_supported_formats": LLAMA_INDEX_DEFAULT_SUPPORTED_FORMATS_LIST,
11681150
# Customize
11691151
"background_image": "",
11701152
"user_image": DEFAULT_USER_IMAGE_PATH,

pyqt_openai/aboutDialog.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,7 @@ def __initUi(self):
5151
descWidget3.setText(
5252
f"""
5353
<br/><br/>Contact: {CONTACT}<br/>
54-
<p>Powered by PySide6</p>
55-
<p>Powered by GPT4Free</p>
56-
<p>Powered by LiteLLM</p>
57-
<p>Powered by LlamaIndex</p>
54+
<p>Powered by<br><br> PySide6, GPT4Free, LiteLLM,<br>LlamaIndex</p>
5855
"""
5956
)
6057

pyqt_openai/chat_widget/center/prompt.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -232,14 +232,14 @@ def __setEveryPromptCommands(self):
232232
if group.prompt_type == "form":
233233
value = ""
234234
for entry in entries:
235-
content = entry.content
236-
if content and content.strip():
237-
value += f"{entry.name}: {content}\n"
235+
prompt = entry.prompt
236+
if prompt and prompt.strip():
237+
value += f"{entry.act}: {prompt}\n"
238238
command_obj_lst.append({"name": group.name, "value": value})
239239
elif group.prompt_type == "sentence":
240240
for entry in entries:
241241
command_obj_lst.append(
242-
{"name": f"{entry.name}({group.name})", "value": entry.content}
242+
{"name": f"{entry.act}({group.name})", "value": entry.prompt}
243243
)
244244
self.__p_grp = [
245245
{"name": obj["name"], "value": obj["value"]} for obj in command_obj_lst

pyqt_openai/chat_widget/chatMainWidget.py

-7
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,6 @@ def __initUi(self):
100100

101101
self.__chatWidget.setG4F(self.__chatRightSideBarWidget.currentTabIdx())
102102

103-
try:
104-
self.__chatRightSideBarWidget.onDirectorySelected.connect(
105-
LLAMAINDEX_WRAPPER.set_directory
106-
)
107-
except Exception as e:
108-
QMessageBox.critical(self, LangClass.TRANSLATIONS["Error"], str(e))
109-
110103
self.__promptGeneratorWidget = PromptGeneratorWidget()
111104

112105
self.__sideBarBtn = Button()

0 commit comments

Comments
 (0)