Skip to content

Commit

Permalink
Merge pull request #4 from asakura42/feature
Browse files Browse the repository at this point in the history
Feature
  • Loading branch information
asakura42 authored Mar 4, 2024
2 parents 6ffb1f4 + 5092ae7 commit 51e7136
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@ classifiers = [

[project.scripts]
rp4 = "rp4.__main__:main"

[tool.black]
line-length = 120
target-version = ['py311']
20 changes: 19 additions & 1 deletion rp4/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,22 @@ def init_ui(self):
self.format_md_checkbox.setChecked(self.chatgpt_client.globals.md2html)
settings_layout.addWidget(self.format_md_checkbox)

# Max tokens and temperature
self.max_tokens_spinbox = QSpinBox()
self.max_tokens_spinbox.setRange(1, 9999)
self.max_tokens_spinbox.setValue(self.chatgpt_client.globals.max_tokens)
self.temperature_spinbox = QDoubleSpinBox()
self.temperature_spinbox.setRange(0, 1)
self.temperature_spinbox.setSingleStep(0.1)
self.temperature_spinbox.setDecimals(1)
self.temperature_spinbox.setValue(self.chatgpt_client.globals.temperature)
hbox = QHBoxLayout()
hbox.addWidget(QLabel("Max tokens"))
hbox.addWidget(self.max_tokens_spinbox)
hbox.addWidget(QLabel("Temperature"))
hbox.addWidget(self.temperature_spinbox)
settings_layout.addLayout(hbox)

# HR
hline = QFrame(self)
hline.setObjectName("line")
Expand Down Expand Up @@ -474,8 +490,10 @@ def _current_settings_from_gui(self):
theme=self.theme_dropdown.currentText(),
model_names=[self.model_dropdown.itemText(item) for item in range(self.model_dropdown.count())],
selected_preset=self.preset_dropdown.currentText(),
verbose=False,
verbose=self.chatgpt_client.globals.verbose, # echo back
md2html=self.format_md_checkbox.isChecked(),
max_tokens=self.max_tokens_spinbox.value(),
temperature=self.temperature_spinbox.value(),
)

def sync_settings_with_backend(self):
Expand Down

0 comments on commit 51e7136

Please sign in to comment.