Skip to content

Commit

Permalink
v4.7
Browse files Browse the repository at this point in the history
  • Loading branch information
AndraxDev committed May 13, 2024
1 parent 93f6011 commit 3a8c30c
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 185 deletions.
27 changes: 3 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,31 +64,10 @@ Repo can be found [here](https://github.com/AndraxDev/speak-gpt-web)
- [x] AMOLED dark mode
- [x] Custom API provider support
- [x] Customize models params like temperature, topP, frequencyPenalty, presencePenalty and logit_bias
- [x] Playground
- [x] GPT 4o

## Task list

### ✔️ Already added

- [x] Chat
- [x] GPT 4 Vision (use your images and photos with ChatGPT)
- [x] Activation prompt
- [x] System message
- [x] Voice input (Whisper and Google)
- [x] Assistant
- [x] SpeakGPT in context menu
- [x] SpeakGPT in Share sheet
- [x] Prompts store
- [x] Different chat layout
- [x] Adaptive design
- [x] DALL-e integration
- [x] A lot of different models
- [x] Add support of custom fine-tuned models
- [o] Function calling features
- [x] AMOLED dark mode
- [x] Custom API provider support
- [x] Customize models params like temperature, topP, frequencyPenalty, presencePenalty and logit_bias

### ❌ Planned to add (Share your ideas in Issues)
## ❌ Planned to add (Share your ideas in Issues)

- [ ] Device routines (like set alarm or open app)
- [ ] Sync chat history
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ class ChatListAdapter(private val dataArray: ArrayList<HashMap<String, String>>,
textModel.text = if (model.lowercase().contains("gpt-4") && !model.lowercase().contains("turbo")) "GPT 4" else textModel.text
textModel.text = if (model.lowercase().contains("gpt-3.5") && model.lowercase().contains("turbo") && model.lowercase().contains("0125")) "GPT 3.5 (0125)" else textModel.text
textModel.text = if (model.lowercase().contains("gpt-3.5") && model.lowercase().contains("turbo") && !model.lowercase().contains("0125")) "GPT 3.5 Turbo" else textModel.text

textModel.text = if (model.lowercase().contains("gpt-4o")) "GPT 4o" else textModel.text
}

private fun reloadCards(chatMessage: HashMap<String, String>) {
Expand Down Expand Up @@ -286,6 +286,10 @@ class ChatListAdapter(private val dataArray: ArrayList<HashMap<String, String>>,
updateCard(selector, icon, pinMarker, R.color.tint_blue, R.color.gpt_icon_blue, chatMessage)
}

"GPT 4o" -> {
updateCard(selector, icon, pinMarker, R.color.tint_cyan, R.color.gpt_icon_cyan, chatMessage)
}

else -> {
icon.setImageResource(R.drawable.chatgpt_icon)
DrawableCompat.setTint(icon.getDrawable(), ContextCompat.getColor(mContext.requireActivity(), R.color.accent_900))
Expand All @@ -304,6 +308,8 @@ class ChatListAdapter(private val dataArray: ArrayList<HashMap<String, String>>,
pin.background = getAccentDrawable(
ContextCompat.getDrawable(mContext.requireActivity(), R.drawable.btn_accent_tonal_transparent)!!, mContext.requireActivity().getColor(tintColor))

DrawableCompat.setTint(pin.getDrawable(), ContextCompat.getColor(mContext.requireActivity(), iconColor))

if (preferences?.getAvatarTypeByChatId(Hash.hash(chatMessage["name"].toString()), mContext.requireActivity()) == "builtin") {
DrawableCompat.setTint(icon.getDrawable(), ContextCompat.getColor(mContext.requireActivity(), iconColor))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,10 @@ class AdvancedSettingsDialogFragment : DialogFragment() {

private var builder: AlertDialog.Builder? = null
private var gpt_35_turbo: RadioButton? = null
private var gpt_35_turbo_1106: RadioButton? = null
private var gpt_35_turbo_0125: RadioButton? = null
private var gpt_4: RadioButton? = null
private var gpt_4_turbo: RadioButton? = null
private var gpt_4_32k: RadioButton? = null
private var gpt_4_o: RadioButton? = null
private var see_all_models: RadioButton? = null
private var see_favorite_models: RadioButton? = null
private var ft: RadioButton? = null
Expand Down Expand Up @@ -92,11 +91,10 @@ class AdvancedSettingsDialogFragment : DialogFragment() {
val view: View = this.layoutInflater.inflate(R.layout.fragment_advanced_settings, null)

gpt_35_turbo = view.findViewById(R.id.gpt_35_turbo)
gpt_35_turbo_1106 = view.findViewById(R.id.gpt_35_turbo_1106)
gpt_35_turbo_0125 = view.findViewById(R.id.gpt_35_turbo_0125)
gpt_4 = view.findViewById(R.id.gpt_4)
gpt_4_turbo = view.findViewById(R.id.gpt_4_turbo)
gpt_4_32k = view.findViewById(R.id.gpt_4_32k)
gpt_4_o = view.findViewById(R.id.gpt_4_o)
see_all_models = view.findViewById(R.id.see_all_models)
see_favorite_models = view.findViewById(R.id.see_favorite_models)
ft = view.findViewById(R.id.ft)
Expand Down Expand Up @@ -161,14 +159,6 @@ class AdvancedSettingsDialogFragment : DialogFragment() {
ContextCompat.getDrawable(requireActivity(), R.drawable.btn_accent_tonal_selector_v4)!!)
ftFrame?.visibility = View.GONE
}
gpt_35_turbo_1106?.setOnClickListener {
model = "gpt-3.5-turbo-1106"
clearSelection()
gpt_35_turbo_1106?.setTextColor(ContextCompat.getColor(requireActivity(), R.color.window_background))
gpt_35_turbo_1106?.background = getDarkAccentDrawableV2(
ContextCompat.getDrawable(requireActivity(), R.drawable.btn_accent_tonal_selector_v4)!!)
ftFrame?.visibility = View.GONE
}
gpt_35_turbo_0125?.setOnClickListener {
model = "gpt-3.5-turbo-0125"
clearSelection()
Expand All @@ -193,11 +183,11 @@ class AdvancedSettingsDialogFragment : DialogFragment() {
ContextCompat.getDrawable(requireActivity(), R.drawable.btn_accent_tonal_selector_v4)!!)
ftFrame?.visibility = View.GONE
}
gpt_4_32k?.setOnClickListener {
model = "gpt-4-32k"
gpt_4_o?.setOnClickListener {
model = "gpt-4o"
clearSelection()
gpt_4_32k?.setTextColor(ContextCompat.getColor(requireActivity(), R.color.window_background))
gpt_4_32k?.background = getDarkAccentDrawableV2(
gpt_4_o?.setTextColor(ContextCompat.getColor(requireActivity(), R.color.window_background))
gpt_4_o?.background = getDarkAccentDrawableV2(
ContextCompat.getDrawable(requireActivity(), R.drawable.btn_accent_tonal_selector_v4)!!)
ftFrame?.visibility = View.GONE
}
Expand All @@ -215,57 +205,7 @@ class AdvancedSettingsDialogFragment : DialogFragment() {
advancedModelSelectorDialogFragment.setModelSelectedListener { model ->
this@AdvancedSettingsDialogFragment.model = model

when (model) {
"gpt-3.5-turbo" -> {
gpt_35_turbo?.isChecked = true
clearSelection()
gpt_35_turbo?.setTextColor(ContextCompat.getColor(requireActivity(), R.color.window_background))
gpt_35_turbo?.background = getDarkAccentDrawableV2(
ContextCompat.getDrawable(requireActivity(), R.drawable.btn_accent_tonal_selector_v4)!!)
ftFrame?.visibility = View.GONE
}
"gpt-3.5-turbo-0125" -> {
gpt_35_turbo_0125?.isChecked = true
clearSelection()
gpt_35_turbo_0125?.setTextColor(ContextCompat.getColor(requireActivity(), R.color.window_background))
gpt_35_turbo_0125?.background = getDarkAccentDrawableV2(
ContextCompat.getDrawable(requireActivity(), R.drawable.btn_accent_tonal_selector_v4)!!)
ftFrame?.visibility = View.GONE
}
"gpt-4" -> {
gpt_4?.isChecked = true
clearSelection()
gpt_4?.setTextColor(ContextCompat.getColor(requireActivity(), R.color.window_background))
gpt_4?.background = getDarkAccentDrawableV2(
ContextCompat.getDrawable(requireActivity(), R.drawable.btn_accent_tonal_selector_v4)!!)
ftFrame?.visibility = View.GONE
}
"gpt-4-turbo-preview" -> {
gpt_4_turbo?.isChecked = true
clearSelection()
gpt_4_turbo?.setTextColor(ContextCompat.getColor(requireActivity(), R.color.window_background))
gpt_4_turbo?.background = getDarkAccentDrawableV2(
ContextCompat.getDrawable(requireActivity(), R.drawable.btn_accent_tonal_selector_v4)!!)
ftFrame?.visibility = View.GONE
}
"gpt-4-32k" -> {
gpt_4_32k?.isChecked = true
clearSelection()
gpt_4_32k?.setTextColor(ContextCompat.getColor(requireActivity(), R.color.window_background))
gpt_4_32k?.background = getDarkAccentDrawableV2(
ContextCompat.getDrawable(requireActivity(), R.drawable.btn_accent_tonal_selector_v4)!!)
ftFrame?.visibility = View.GONE
}
else -> {
ft?.isChecked = true
ftInput?.setText(model)
clearSelection()
ft?.setTextColor(ContextCompat.getColor(requireActivity(), R.color.window_background))
ft?.background = getDarkAccentDrawableV2(
ContextCompat.getDrawable(requireActivity(), R.drawable.btn_accent_tonal_selector_v4)!!)
ftFrame?.visibility = View.VISIBLE
}
}
reloadModelList(model)
}
advancedModelSelectorDialogFragment.show(requireActivity().supportFragmentManager, "advancedModelSelectorDialogFragment")
}
Expand All @@ -275,57 +215,7 @@ class AdvancedSettingsDialogFragment : DialogFragment() {
advancedModelSelectorDialogFragment.setModelSelectedListener { model ->
this@AdvancedSettingsDialogFragment.model = model

when (model) {
"gpt-3.5-turbo" -> {
gpt_35_turbo?.isChecked = true
clearSelection()
gpt_35_turbo?.setTextColor(ContextCompat.getColor(requireActivity(), R.color.window_background))
gpt_35_turbo?.background = getDarkAccentDrawableV2(
ContextCompat.getDrawable(requireActivity(), R.drawable.btn_accent_tonal_selector_v4)!!)
ftFrame?.visibility = View.GONE
}
"gpt-3.5-turbo-0125" -> {
gpt_35_turbo_0125?.isChecked = true
clearSelection()
gpt_35_turbo_0125?.setTextColor(ContextCompat.getColor(requireActivity(), R.color.window_background))
gpt_35_turbo_0125?.background = getDarkAccentDrawableV2(
ContextCompat.getDrawable(requireActivity(), R.drawable.btn_accent_tonal_selector_v4)!!)
ftFrame?.visibility = View.GONE
}
"gpt-4" -> {
gpt_4?.isChecked = true
clearSelection()
gpt_4?.setTextColor(ContextCompat.getColor(requireActivity(), R.color.window_background))
gpt_4?.background = getDarkAccentDrawableV2(
ContextCompat.getDrawable(requireActivity(), R.drawable.btn_accent_tonal_selector_v4)!!)
ftFrame?.visibility = View.GONE
}
"gpt-4-turbo-preview" -> {
gpt_4_turbo?.isChecked = true
clearSelection()
gpt_4_turbo?.setTextColor(ContextCompat.getColor(requireActivity(), R.color.window_background))
gpt_4_turbo?.background = getDarkAccentDrawableV2(
ContextCompat.getDrawable(requireActivity(), R.drawable.btn_accent_tonal_selector_v4)!!)
ftFrame?.visibility = View.GONE
}
"gpt-4-32k" -> {
gpt_4_32k?.isChecked = true
clearSelection()
gpt_4_32k?.setTextColor(ContextCompat.getColor(requireActivity(), R.color.window_background))
gpt_4_32k?.background = getDarkAccentDrawableV2(
ContextCompat.getDrawable(requireActivity(), R.drawable.btn_accent_tonal_selector_v4)!!)
ftFrame?.visibility = View.GONE
}
else -> {
ft?.isChecked = true
ftInput?.setText(model)
clearSelection()
ft?.setTextColor(ContextCompat.getColor(requireActivity(), R.color.window_background))
ft?.background = getDarkAccentDrawableV2(
ContextCompat.getDrawable(requireActivity(), R.drawable.btn_accent_tonal_selector_v4)!!)
ftFrame?.visibility = View.VISIBLE
}
}
reloadModelList(model)
}
advancedModelSelectorDialogFragment.show(requireActivity().supportFragmentManager, "advancedFavoriteModelSelectorDialogFragment")
}
Expand All @@ -350,8 +240,13 @@ class AdvancedSettingsDialogFragment : DialogFragment() {
.setNegativeButton(R.string.btn_cancel) { _, _ -> }

model = requireArguments().getString("name").toString()
reloadModelList(model)

when (requireArguments().getString("name")) { // load default model if settings not found
return builder!!.create()
}

private fun reloadModelList(model: String) {
when (model) { // load default model if settings not found
"gpt-3.5-turbo" -> {
gpt_35_turbo?.isChecked = true
clearSelection()
Expand All @@ -360,14 +255,6 @@ class AdvancedSettingsDialogFragment : DialogFragment() {
ContextCompat.getDrawable(requireActivity(), R.drawable.btn_accent_tonal_selector_v4)!!)
ftFrame?.visibility = View.GONE
}
"gpt-3.5-turbo-1106" -> {
gpt_35_turbo_1106?.isChecked = true
clearSelection()
gpt_35_turbo_1106?.setTextColor(ContextCompat.getColor(requireActivity(), R.color.window_background))
gpt_35_turbo_1106?.background = getDarkAccentDrawableV2(
ContextCompat.getDrawable(requireActivity(), R.drawable.btn_accent_tonal_selector_v4)!!)
ftFrame?.visibility = View.GONE
}
"gpt-3.5-turbo-0125" -> {
gpt_35_turbo_0125?.isChecked = true
clearSelection()
Expand All @@ -392,11 +279,11 @@ class AdvancedSettingsDialogFragment : DialogFragment() {
ContextCompat.getDrawable(requireActivity(), R.drawable.btn_accent_tonal_selector_v4)!!)
ftFrame?.visibility = View.GONE
}
"gpt-4-32k" -> {
gpt_4_32k?.isChecked = true
"gpt-4o" -> {
gpt_4_o?.isChecked = true
clearSelection()
gpt_4_32k?.setTextColor(ContextCompat.getColor(requireActivity(), R.color.window_background))
gpt_4_32k?.background = getDarkAccentDrawableV2(
gpt_4_o?.setTextColor(ContextCompat.getColor(requireActivity(), R.color.window_background))
gpt_4_o?.background = getDarkAccentDrawableV2(
ContextCompat.getDrawable(requireActivity(), R.drawable.btn_accent_tonal_selector_v4)!!)
ftFrame?.visibility = View.GONE
}
Expand All @@ -410,8 +297,6 @@ class AdvancedSettingsDialogFragment : DialogFragment() {
ftFrame?.visibility = View.VISIBLE
}
}

return builder!!.create()
}

private fun clearSelection() {
Expand All @@ -427,10 +312,6 @@ class AdvancedSettingsDialogFragment : DialogFragment() {
ContextCompat.getDrawable(requireActivity(), R.drawable.btn_accent_tonal_selector_v3)!!, requireActivity())
gpt_35_turbo?.setTextColor(ContextCompat.getColor(requireActivity(), R.color.neutral_200))

gpt_35_turbo_1106?.background = getDarkAccentDrawable(
ContextCompat.getDrawable(requireActivity(), R.drawable.btn_accent_tonal_selector_v3)!!, requireActivity())
gpt_35_turbo_1106?.setTextColor(ContextCompat.getColor(requireActivity(), R.color.neutral_200))

gpt_35_turbo_0125?.background = getDarkAccentDrawable(
ContextCompat.getDrawable(requireActivity(), R.drawable.btn_accent_tonal_selector_v3)!!, requireActivity())
gpt_35_turbo_0125?.setTextColor(ContextCompat.getColor(requireActivity(), R.color.neutral_200))
Expand All @@ -443,9 +324,9 @@ class AdvancedSettingsDialogFragment : DialogFragment() {
ContextCompat.getDrawable(requireActivity(), R.drawable.btn_accent_tonal_selector_v3)!!, requireActivity())
gpt_4_turbo?.setTextColor(ContextCompat.getColor(requireActivity(), R.color.neutral_200))

gpt_4_32k?.background = getDarkAccentDrawable(
gpt_4_o?.background = getDarkAccentDrawable(
ContextCompat.getDrawable(requireActivity(), R.drawable.btn_accent_tonal_selector_v3)!!, requireActivity())
gpt_4_32k?.setTextColor(ContextCompat.getColor(requireActivity(), R.color.neutral_200))
gpt_4_o?.setTextColor(ContextCompat.getColor(requireActivity(), R.color.neutral_200))

ft?.background = getDarkAccentDrawable(
ContextCompat.getDrawable(requireActivity(), R.drawable.btn_accent_tonal_selector_v3)!!, requireActivity())
Expand Down
18 changes: 2 additions & 16 deletions app/src/main/res/layout/fragment_advanced_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,6 @@
android:text="GPT 3.5"
android:textSize="16sp" />

<RadioButton
android:id="@+id/gpt_35_turbo_1106"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:button="@null"
android:minHeight="56dp"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:text="GPT 3.5 (Long context) (1106)"
android:textSize="16sp"
android:visibility="gone" />

<RadioButton
android:id="@+id/gpt_35_turbo_0125"
android:layout_width="match_parent"
Expand Down Expand Up @@ -159,7 +145,7 @@
android:visibility="gone" />

<RadioButton
android:id="@+id/gpt_4_32k"
android:id="@+id/gpt_4_o"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
Expand All @@ -168,7 +154,7 @@
android:minHeight="56dp"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:text="GPT 4 (Extended version, 32k)"
android:text="GPT 4o (Most capable model)"
android:textSize="16sp" />

<RadioButton
Expand Down
Loading

0 comments on commit 3a8c30c

Please sign in to comment.