mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-12 12:03:17 +02:00
Handle empty summaries
This commit is contained in:
@@ -190,6 +190,10 @@ public class AI {
|
||||
|
||||
HtmlHelper.truncate(d, MAX_SUMMARIZE_TEXT_SIZE);
|
||||
|
||||
String body = d.body().text().trim();
|
||||
if (TextUtils.isEmpty(body))
|
||||
return null;
|
||||
|
||||
String templatePrompt = null;
|
||||
if (template > 0L) {
|
||||
DB db = DB.getInstance(context);
|
||||
@@ -218,7 +222,7 @@ public class AI {
|
||||
OpenAI.Content.get(ssb, message.id, context)));
|
||||
} else
|
||||
input.add(new OpenAI.Message(OpenAI.USER, new OpenAI.Content[]{
|
||||
new OpenAI.Content(OpenAI.CONTENT_TEXT, d.text())}));
|
||||
new OpenAI.Content(OpenAI.CONTENT_TEXT, body)}));
|
||||
|
||||
OpenAI.Message[] completions =
|
||||
OpenAI.completeChat(context, model, input.toArray(new OpenAI.Message[0]), temperature, 1);
|
||||
@@ -235,8 +239,6 @@ public class AI {
|
||||
float temperature = prefs.getFloat("gemini_temperature", Gemini.DEFAULT_TEMPERATURE);
|
||||
String defaultPrompt = prefs.getString("gemini_summarize", Gemini.DEFAULT_SUMMARY_PROMPT);
|
||||
|
||||
String body = d.text();
|
||||
|
||||
List<String> texts = new ArrayList<>();
|
||||
texts.add(templatePrompt == null ? defaultPrompt : templatePrompt);
|
||||
if (!TextUtils.isEmpty(body))
|
||||
|
||||
Reference in New Issue
Block a user