mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-07-02 03:40:38 +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 }}
|
||||
======
|
||||
|
||||
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
|
||||
- Address unresolved issues from earlier discussions
|
||||
- Build upon existing knowledge without contradictions
|
||||
|
@ -119,8 +119,8 @@ class PR_LineQuestions:
|
||||
# retrieve thread comments
|
||||
thread_comments = self.git_provider.get_review_thread_comments(comment_id)
|
||||
|
||||
# generate conversation history
|
||||
conversation_history = []
|
||||
# filter and prepare comments
|
||||
filtered_comments = []
|
||||
for comment in thread_comments:
|
||||
body = getattr(comment, 'body', '')
|
||||
|
||||
@ -130,12 +130,17 @@ class PR_LineQuestions:
|
||||
|
||||
user = comment.user
|
||||
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
|
||||
if conversation_history:
|
||||
get_logger().info(f"Loaded {len(conversation_history)} comments from the code review thread")
|
||||
return "\n\n".join(conversation_history)
|
||||
# transform conversation history to string using the same pattern as get_commit_messages
|
||||
if filtered_comments:
|
||||
comment_count = len(filtered_comments)
|
||||
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 ""
|
||||
|
||||
|
Reference in New Issue
Block a user