Skip to content

Commit d423131

Browse files
Riandyfacebook-github-bot
authored andcommitted
Android app UI/flow improvements (#5241)
Summary: Pull Request resolved: #5241 - Add default system prompt - Set temperature to 0 - Load model directly upon click Reviewed By: cmodi-meta, kirklandsign Differential Revision: D62472502 fbshipit-source-id: 8ecc88ee4474afa50658e93955c49ff0f3eef745
1 parent e4d72ce commit d423131

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

examples/demo-apps/android/LlamaDemo/app/src/main/java/com/example/executorchllamademo/PromptFormat.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public class PromptFormat {
1313
public static final String SYSTEM_PLACEHOLDER = "{{ system_prompt }}";
1414
public static final String USER_PLACEHOLDER = "{{ user_prompt }}";
1515
public static final String ASSISTANT_PLACEHOLDER = "{{ assistant_response }}";
16+
public static final String DEFAULT_SYSTEM_PROMPT = "Answer the questions in a few sentences";
1617

1718
public static String getSystemPromptTemplate(ModelType modelType) {
1819
switch (modelType) {

examples/demo-apps/android/LlamaDemo/app/src/main/java/com/example/executorchllamademo/SettingsActivity.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public class SettingsActivity extends AppCompatActivity {
4343
public SettingsFields mSettingsFields;
4444

4545
private DemoSharedPreferences mDemoSharedPreferences;
46-
public static double TEMPERATURE_MIN_VALUE = 0.1;
46+
public static double TEMPERATURE_MIN_VALUE = 0.0;
4747

4848
@Override
4949
protected void onCreate(Bundle savedInstanceState) {
@@ -120,6 +120,7 @@ private void setupLoadModelButton() {
120120
public void onClick(DialogInterface dialog, int whichButton) {
121121
mSettingsFields.saveLoadModelAction(true);
122122
mLoadModelButton.setEnabled(false);
123+
onBackPressed();
123124
}
124125
})
125126
.setNegativeButton(android.R.string.no, null)
@@ -208,8 +209,7 @@ public void afterTextChanged(Editable s) {
208209
new DialogInterface.OnClickListener() {
209210
public void onClick(DialogInterface dialog, int whichButton) {
210211
// Clear the messageAdapter and sharedPreference
211-
mSystemPromptEditText.setText(
212-
PromptFormat.getSystemPromptTemplate(mModelType));
212+
mSystemPromptEditText.setText(PromptFormat.DEFAULT_SYSTEM_PROMPT);
213213
}
214214
})
215215
.setNegativeButton(android.R.string.no, null)

0 commit comments

Comments
 (0)