Skip to content

Commit

Permalink
Tuned maxtokens description
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiecraane committed Apr 5, 2023
1 parent 410000c commit 7b67721
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ class GptMentorConfigurable : Configurable {
c.gridx = 0
settingsPanel.add(JLabel("", JLabel.TRAILING), c)
c.gridx = 1
settingsPanel.add(JLabel("The maximum number of tokens to generate in the output. Longer outputs may take longer to generate.", JLabel.LEADING), c)
settingsPanel.add(JLabel("""The maximum number of tokens to generate in the output. Longer outputs may take longer to generate.
|The maxtokens of the completion and the input combined cannot exceed 4096.
""".trimMargin(), JLabel.LEADING), c)
return gridY1
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class GptMentorSettingsState : PersistentStateComponent<GptMentorSettingsState>
}

companion object {
fun getInstance() = ApplicationManager.getApplication().getService(GptMentorSettingsState::class.java)
fun getInstance(): GptMentorSettingsState = ApplicationManager.getApplication().getService(GptMentorSettingsState::class.java)

const val DEFAULT_PROMPT = "You are an expert AI programmer."

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class ChatPresenter(
chatView.clearPrompt()
chatView.updateNumberOfTokens("")
chatContext = chatContext.addMessage(explanationBuilder.toString(), ChatGptRequest.Message.Role.SYSTEM)
historyRepository.addOrUpdateHistoryItem(HistoryItem.from(chatContext))
historyRepository.addOrUpdateHistoryItem(HistoryItem.from(chatContext, state = GptMentorSettingsState.getInstance()))
}

fun onStopClicked() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ data class HistoryItem(
fun from(
chatContext: ChatContext,
timestamp: Long = System.currentTimeMillis(),
state: GptMentorSettingsState = GptMentorSettingsState.getInstance(),
state: GptMentorSettingsState,
): HistoryItem {
val state = state
val request = chatContext.chat.createRequest(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class HistoryItemTest {
systemMessage = "System message"
)

val from = HistoryItem.from(ChatContext("1", prompt))
val from = HistoryItem.from(ChatContext("1", prompt), state = GptMentorSettingsState())
assertTrue(from.id.isNotEmpty())
// Assert message
assertEquals("Hello!", from.title)
Expand Down

0 comments on commit 7b67721

Please sign in to comment.