Skip to content

Commit

Permalink
fixes font issues so that emoji display correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
w4ffl35 committed Oct 13, 2024
1 parent 09744f8 commit 43ffa2c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/airunner/data/models/settings_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class LLMGeneratorSettings(Base):
use_gpu = Column(Boolean, default=True)
message_type = Column(String, default="chat")
override_parameters = Column(Boolean, default=True)
current_chatbot = Column(Integer, default=0)
current_chatbot = Column(Integer, default=1)
prompt_template = Column(String, default="Mistral 7B Instruct: Default Chatbot")
batch_size = Column(Integer, default=1)
use_api = Column(Boolean, default=False)
Expand Down
15 changes: 9 additions & 6 deletions src/airunner/widgets/llm/message_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,16 @@ def set_chat_font(self):
self.font_family = font_family
self.font_size = font_size
# Check if the font family is available
if self.font_family in QFontDatabase().families():
available_families = QFontDatabase().families()
if self.font_family in available_families:
font = QFont(self.font_family, self.font_size)
font.setFamilies([
self.font_family,
"Noto Color Emoji",
])
self.ui.content.setFont(font)
else:
font = QFont("Ubuntu", self.font_size) # Fallback to Ubuntu if Arial is not available
font.setFamilies([
font.family(),
"Noto Color Emoji",
])
self.ui.content.setFont(font)

def set_content_size(self):
doc_height = self.ui.content.document().size().height()
Expand Down
8 changes: 7 additions & 1 deletion src/airunner/windows/main/settings_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@ def whisper_settings(self) -> WhisperSettings:

@property
def llm_generator_settings(self) -> LLMGeneratorSettings:
return self.db_handler.load_settings_from_db(LLMGeneratorSettings)
settings = self.db_handler.load_settings_from_db(LLMGeneratorSettings)
if settings.current_chatbot == 0:
chatbots = self.chatbots
if len(chatbots) > 0:
settings.current_chatbot = self.chatbots[0].id
self.update_settings_by_name("llm_generator_settings", "current_chatbot", settings.current_chatbot)
return settings

@property
def generator_settings(self) -> GeneratorSettings:
Expand Down

0 comments on commit 43ffa2c

Please sign in to comment.