From 6f4f76aac6125d0245afd9e35423de67b90fb89f Mon Sep 17 00:00:00 2001 From: Versun Date: Tue, 25 Jun 2024 00:49:13 +0000 Subject: [PATCH 1/3] feat: set translate title field default value(False) in models --- .../0016_alter_t_feed_translate_title.py | 18 ++++++++++++++++++ core/models.py | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 core/migrations/0016_alter_t_feed_translate_title.py diff --git a/core/migrations/0016_alter_t_feed_translate_title.py b/core/migrations/0016_alter_t_feed_translate_title.py new file mode 100644 index 0000000..f3528dc --- /dev/null +++ b/core/migrations/0016_alter_t_feed_translate_title.py @@ -0,0 +1,18 @@ +# Generated by Django 5.0.6 on 2024-06-25 00:48 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0015_rename_tagulous_o_feed_tags_tagulous_o_feed_category_and_more'), + ] + + operations = [ + migrations.AlterField( + model_name='t_feed', + name='translate_title', + field=models.BooleanField(default=False, verbose_name='Translate Title'), + ), + ] diff --git a/core/models.py b/core/models.py index 4fc2e5a..66760b9 100644 --- a/core/models.py +++ b/core/models.py @@ -158,7 +158,7 @@ class T_Feed(models.Model): editable=False, ) - translate_title = models.BooleanField(_("Translate Title"), default=True) + translate_title = models.BooleanField(_("Translate Title"), default=False) translate_content = models.BooleanField(_("Translate Content"), default=False) summary = models.BooleanField(_("Summary"), default=False) From 60c010e528f02a8ad2bff42fbf49649dff697135 Mon Sep 17 00:00:00 2001 From: Versun Date: Thu, 27 Jun 2024 01:27:12 +0000 Subject: [PATCH 2/3] feat: add HTTP-Referer and X-Title headers to OpenAIInterface --- translator/models/base.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/translator/models/base.py b/translator/models/base.py index c2262d2..87af615 100644 --- a/translator/models/base.py +++ b/translator/models/base.py @@ -159,6 +159,10 @@ def translate( system_prompt += f"\n\n{user_prompt}" res = client.with_options(max_retries=3).chat.completions.create( + extra_headers={ + "HTTP-Referer": "https://www.rsstranslator.com", + "X-Title": "RSS Translator" + }, model=self.model, messages=[ {"role": "system", "content": system_prompt}, From bc2bf1ba0d6f7aafb2d2c931c53e1d27a9680355 Mon Sep 17 00:00:00 2001 From: Versun Date: Thu, 27 Jun 2024 01:27:59 +0000 Subject: [PATCH 3/3] update version --- templates/admin/base_site.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/admin/base_site.html b/templates/admin/base_site.html index c66220e..fec1a50 100644 --- a/templates/admin/base_site.html +++ b/templates/admin/base_site.html @@ -4,7 +4,7 @@