Revert the chat history for rewrite. (#4579)

### What problem does this PR solve?


### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Kevin Hu 2025-01-22 16:55:11 +08:00 committed by GitHub
parent 4b82275ae5
commit cbc3c5297e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 5 additions and 5 deletions

View File

@ -483,7 +483,7 @@ class ComponentBase(ABC):
if q["component_id"].lower().find("answer") == 0:
txt = []
for r, c in self._canvas.history[::-1][:self._param.message_history_window_size]:
for r, c in self._canvas.history[::-1][:self._param.message_history_window_size][::-1]:
txt.append(f"{r.upper()}: {c}")
txt = "\n".join(txt)
self._param.inputs.append({"content": txt, "component_id": q["component_id"]})

View File

@ -84,7 +84,7 @@ class RewriteQuestion(Generate, ABC):
component_name = "RewriteQuestion"
def _run(self, history, **kwargs):
hist = self._canvas.get_history(4)
hist = self._canvas.get_history(self._param.message_history_window_size)
conv = []
for m in hist:
if m["role"] not in ["user", "assistant"]:

View File

@ -717,7 +717,7 @@
]
},
"label": "Template",
"name": "Artical"
"name": "Article"
},
"dragging": false,
"height": 160,

View File

@ -1153,7 +1153,7 @@
],
"presencePenaltyEnabled": true,
"presence_penalty": 0.4,
"prompt": "You are an SEO expert who writes in a direct, practical, educational style that is factual rather than storytelling or narrative, focusing on explaining to {audience} the \"how\" and \"what is\" and \u201cwhy\u201d rather than narrating to the audience. \n - Please write at a sixth grade reading level. \n - ONLY output in Markdown format.\n - Use positive, present tense expressions and avoid using complex words and sentence structures that lack narrative, such as \"reveal\" and \"dig deep.\"\n - Next, please continue writing articles related to our topic with a concise title, {title_0}{title} {keywords_0}{keywords}. \n - Please AVOID repeating what has already been written and do not use the same sentence structure. \n - JUST write the body of the article based on the outline.\n - DO NOT include introduction, title.\n - DO NOT miss anything mentioned in artical outline, except introduction and title.\n - Please use the information I provide to create in-depth, interesting and unique content. Also, incorporate the references and data points I provided earlier into the article to increase its value to the reader.\n - MUST be in language of \"{keywords_0} {title_0}\".\n\n<article_outline>\n{outline}\n\n<article_body>",
"prompt": "You are an SEO expert who writes in a direct, practical, educational style that is factual rather than storytelling or narrative, focusing on explaining to {audience} the \"how\" and \"what is\" and \u201cwhy\u201d rather than narrating to the audience. \n - Please write at a sixth grade reading level. \n - ONLY output in Markdown format.\n - Use positive, present tense expressions and avoid using complex words and sentence structures that lack narrative, such as \"reveal\" and \"dig deep.\"\n - Next, please continue writing articles related to our topic with a concise title, {title_0}{title} {keywords_0}{keywords}. \n - Please AVOID repeating what has already been written and do not use the same sentence structure. \n - JUST write the body of the article based on the outline.\n - DO NOT include introduction, title.\n - DO NOT miss anything mentioned in article outline, except introduction and title.\n - Please use the information I provide to create in-depth, interesting and unique content. Also, incorporate the references and data points I provided earlier into the article to increase its value to the reader.\n - MUST be in language of \"{keywords_0} {title_0}\".\n\n<article_outline>\n{outline}\n\n<article_body>",
"temperature": 0.1,
"temperatureEnabled": true,
"topPEnabled": true,
@ -1293,7 +1293,7 @@
{
"data": {
"form": {
"text": "Let LLM to generate keywords to search. \nBased on the search result, the outline of the artical will be generated."
"text": "Let LLM to generate keywords to search. \nBased on the search result, the outline of the article will be generated."
},
"label": "Note",
"name": "N: Words to search"