mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-05 13:20:39 +08:00
Improve conversation history formatting with numbered comments
This commit is contained in:
@ -50,7 +50,7 @@ Previous discussion on this code:
|
|||||||
{{ conversation_history|trim }}
|
{{ conversation_history|trim }}
|
||||||
======
|
======
|
||||||
|
|
||||||
Consider this conversation history (format: "Username: Message"). When responding:
|
Consider this conversation history (format: "N. Username: Message", where numbers indicate the comment order). When responding:
|
||||||
- Maintain consistency with previous technical explanations
|
- Maintain consistency with previous technical explanations
|
||||||
- Address unresolved issues from earlier discussions
|
- Address unresolved issues from earlier discussions
|
||||||
- Build upon existing knowledge without contradictions
|
- Build upon existing knowledge without contradictions
|
||||||
|
@ -119,8 +119,8 @@ class PR_LineQuestions:
|
|||||||
# retrieve thread comments
|
# retrieve thread comments
|
||||||
thread_comments = self.git_provider.get_review_thread_comments(comment_id)
|
thread_comments = self.git_provider.get_review_thread_comments(comment_id)
|
||||||
|
|
||||||
# generate conversation history
|
# filter and prepare comments
|
||||||
conversation_history = []
|
filtered_comments = []
|
||||||
for comment in thread_comments:
|
for comment in thread_comments:
|
||||||
body = getattr(comment, 'body', '')
|
body = getattr(comment, 'body', '')
|
||||||
|
|
||||||
@ -130,12 +130,17 @@ class PR_LineQuestions:
|
|||||||
|
|
||||||
user = comment.user
|
user = comment.user
|
||||||
author = user.login if hasattr(user, 'login') else 'Unknown'
|
author = user.login if hasattr(user, 'login') else 'Unknown'
|
||||||
conversation_history.append(f"{author}: {body}")
|
filtered_comments.append((author, body))
|
||||||
|
|
||||||
# transform conversation history to string
|
# transform conversation history to string using the same pattern as get_commit_messages
|
||||||
if conversation_history:
|
if filtered_comments:
|
||||||
get_logger().info(f"Loaded {len(conversation_history)} comments from the code review thread")
|
comment_count = len(filtered_comments)
|
||||||
return "\n\n".join(conversation_history)
|
get_logger().info(f"Loaded {comment_count} comments from the code review thread")
|
||||||
|
|
||||||
|
# Format as numbered list, similar to get_commit_messages
|
||||||
|
conversation_history_str = "\n".join([f"{i + 1}. {author}: {body}"
|
||||||
|
for i, (author, body) in enumerate(filtered_comments)])
|
||||||
|
return conversation_history_str
|
||||||
|
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user