Skip to content

Commit

Permalink
添加一个非常简单的历史记录保存与读取
Browse files Browse the repository at this point in the history
修改错误的选项文本
  • Loading branch information
SuperSkidder committed Jun 21, 2023
1 parent fe99950 commit bca2f51
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 7 deletions.
1 change: 0 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ dependencies {
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.navigation:navigation-fragment-ktx:2.4.1'
implementation 'androidx.navigation:navigation-ui-ktx:2.4.1'
implementation 'androidx.core:core-ktx:+'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/me/superskidder/watchgpt/MainFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class MainFragment : Fragment() {
}

private fun update() {
val markdown = buildString {
val content = buildString {
val usemessages = messages.drop(1)
usemessages.forEach { message ->
appendLine(
Expand All @@ -175,7 +175,7 @@ class MainFragment : Fragment() {
}
}

messageView.text = markdown
messageView.text = content
}

private fun requestCompletion(request: ChatGPTRequest, callback: (ChatGPTResponse?) -> Unit) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ fun readHistory(context: Context) {
val gson = GsonBuilder().create()
val config = configManager.getString("history", gson.toJson(messages))
messages = gson.fromJson(config, ArrayList<ChatCompletionMessage>().javaClass)
println(messages.forEach(::println))
}
4 changes: 2 additions & 2 deletions app/src/main/res/layout/fragment_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@
android:id="@+id/radioButton2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="code-davinci-002 "
android:text="gpt-4.0"
android:textColor="#FFFFFF" />

<RadioButton
android:id="@+id/radioButton3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="text-davinci-003"
android:text="gpt-3.5-turbo-0613"
android:textColor="#FFFFFF" />

<Switch
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
plugins {
id 'com.android.application' version '8.0.2' apply false
id 'com.android.library' version '8.0.2' apply false
id 'org.jetbrains.kotlin.android' version '1.9.0-RC' apply false
id 'org.jetbrains.kotlin.android' version '1.8.0' apply false
}

0 comments on commit bca2f51

Please sign in to comment.