Skip to content

Commit af38c1b

Browse files
committed
When importing/exporting prompt of Sentence type, add the ability to add a specific format of csv, and write a related manual
1 parent 1f32376 commit af38c1b

26 files changed

+594
-1010
lines changed

MANIFEST.in

Lines changed: 1 addition & 0 deletions
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

pyqt_openai/__init__.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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
@@ -417,7 +427,7 @@ def move_bin(filename, dst_dir):
417427
DEFAULT_TOKEN_CHUNK_SIZE = 1024
418428

419429
# This doesn't need endpoint
420-
DALLE_ARR = ["dall-e-2", "dall-e-3"]
430+
OPENAI_DEFAULT_IMAGE_MODEL = "dall-e-3"
421431

422432
DEFAULT_DATETIME_FORMAT = "%Y-%m-%d %H:%M:%S"
423433

pyqt_openai/chat_widget/center/prompt.py

Lines changed: 4 additions & 4 deletions
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/left_sidebar/chatImportDialog.py

Lines changed: 0 additions & 206 deletions
This file was deleted.

pyqt_openai/chat_widget/left_sidebar/chatNavWidget.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
import pyqt_openai.globals
1818
from pyqt_openai import THREAD_ORDERBY, ICON_ADD, ICON_IMPORT, ICON_SAVE, ICON_REFRESH
19-
from pyqt_openai.chat_widget.left_sidebar.chatImportDialog import ChatImportDialog
20-
from pyqt_openai.chat_widget.left_sidebar.exportDialog import ExportDialog
2119
from pyqt_openai.chat_widget.left_sidebar.importDialog import ImportDialog
20+
from pyqt_openai.chat_widget.left_sidebar.exportDialog import ExportDialog
21+
from pyqt_openai.chat_widget.left_sidebar.selectChatImportTypeDialog import SelectChatImportTypeDialog
2222
from pyqt_openai.lang.translations import LangClass
2323
from pyqt_openai.models import ChatThreadContainer
2424
from pyqt_openai.globals import DB
@@ -168,11 +168,11 @@ def add(self, called_from_parent=False):
168168
self._model.select()
169169

170170
def __import(self):
171-
dialog = ImportDialog(parent=self)
171+
dialog = SelectChatImportTypeDialog(parent=self)
172172
reply = dialog.exec()
173173
if reply == QDialog.Accepted:
174174
import_type = dialog.getImportType()
175-
chatImportDialog = ChatImportDialog(import_type=import_type, parent=self)
175+
chatImportDialog = ImportDialog(import_type=import_type, parent=self)
176176
reply = chatImportDialog.exec()
177177
if reply == QDialog.Accepted:
178178
data = chatImportDialog.getData()

0 commit comments

Comments
 (0)