Skip to content

Commit

Permalink
feat: change translation title default to false and enhance OpenAI in…
Browse files Browse the repository at this point in the history
…terface headers (#89)
  • Loading branch information
versun authored Jun 27, 2024
1 parent 4c42272 commit dd0fe2e
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
18 changes: 18 additions & 0 deletions core/migrations/0016_alter_t_feed_translate_title.py
Original file line number Diff line number Diff line change
@@ -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'),
),
]
2 changes: 1 addition & 1 deletion core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion templates/admin/base_site.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div id="footer" style="text-align: center;">
<a href="https://rsstranslator.com" title="RSS Translator">RSS Translator</a> ·
<a href="https://afdian.net/a/versun" title="Donate">Donate</a> ·
Version: 2024.6.24
Version: 2024.6.27

<!-- <div class="social">-->

Expand Down
4 changes: 4 additions & 0 deletions translator/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down

0 comments on commit dd0fe2e

Please sign in to comment.