Skip to content

Commit

Permalink
Redesign modelInputManualDialog (will implement that next time, cause…
Browse files Browse the repository at this point in the history
… i'm exhausted)
  • Loading branch information
yjg30737 committed Nov 14, 2024
1 parent 6b41be7 commit 7963285
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
3 changes: 3 additions & 0 deletions pyqt_openai/widgets/APIInputButton.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@


class APIInputButton(QPushButton):
"""
Stylish button for opening the API settings dialog.
"""
def __init__(self, base_color="#007BFF"):
super().__init__()
self.setObjectName("modernButton")
Expand Down
35 changes: 15 additions & 20 deletions pyqt_openai/widgets/modelInputManualDialog.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from PySide6.QtCore import Qt
from PySide6.QtGui import QFont
from PySide6.QtWidgets import QDialog, QLabel, QHBoxLayout, QTableWidget
from PySide6.QtWidgets import QDialog, QLabel, QHBoxLayout

from pyqt_openai import SMALL_LABEL_PARAM
from pyqt_openai.util.common import get_litellm_prefixes


class ModelInputManualDialog(QDialog):
Expand All @@ -14,31 +13,27 @@ def __init__(self, parent=None):

def __initVal(self):
self.__warningMessage = (
"💡 <b>Tip</b> For models other than OpenAI and Anthropic, enter the model name as `[ProviderName]/[ModelName]`.\n\n"
"🔗 For details on `ProviderName` and `ModelName`, check out the "
"<a href='https://docs.litellm.ai/docs/providers'>LiteLLM documentation</a>! 😊\n\n"
"⚠️ Note: Some models may not support <b>JSON Mode</b> or <b>LlamaIndex</b> features."
"💡 <b>Tip:</b> For models other than OpenAI and Anthropic, enter the model name as "
"<code>[ProviderName]/[ModelName]</code>.<br><br>"
"🔗 For details on <b>ProviderName</b> and <b>ModelName</b>, check out the "
"<a href='https://docs.litellm.ai/docs/providers'>LiteLLM documentation</a>! 😊<br><br>"
"⚠️ <b>Note:</b> Some models may not support <b>JSON Mode</b> or <b>LlamaIndex</b> features."
)

def __initUi(self):
self.setWindowTitle('Model Input Manual')
self.__warningLbl = QLabel()
self.__warningLbl.setStyleSheet("color: orange;")
self.__warningLbl.setOpenExternalLinks(True)
self.__warningLbl.setStyleSheet(
"color: orange;"
) # Text color remains orange for visibility.
self.__warningLbl.setWordWrap(True)
self.__warningLbl.setFont(QFont(SMALL_LABEL_PARAM))
self.__warningLbl.setText(self.__warningMessage)
self.__warningLbl.setTextInteractionFlags(
Qt.TextInteractionFlag.TextSelectableByMouse
Qt.TextInteractionFlag.TextBrowserInteraction
)

# prefixTable = QTableWidget()
# prefixes = get_litellm_prefixes()
# prefixTable.setColumnCount(len(list(prefixes[0].keys())))
# prefixTable.setHorizontalHeaderLabels(list(prefixes[0].keys()))
# for prefix in prefixes:
# prefixTable.insertRow(prefixTable.rowCount())
# prefixTable.setItem(prefixTable.rowCount() - 1, 0, QLabel(prefix))
self.__warningLbl.setOpenExternalLinks(True) # Enable hyperlink functionality.
self.__warningLbl.setText(self.__warningMessage) # Ensure HTML is passed as text.

lay = QHBoxLayout()
lay.addWidget(self.__warningLbl)
# lay.addWidget(prefixTable)
self.setLayout(lay)
self.setLayout(lay)

0 comments on commit 7963285

Please sign in to comment.