poc: fixes gpt instruction to return the correct index
This commit is contained in:
parent
6dd78aeb22
commit
d9e010c65a
2 changed files with 8 additions and 1 deletions
|
|
@ -85,7 +85,7 @@ class AIServiceBase:
|
|||
+ ("\n\nADDITIONAL CUSTOM INSTRUCTIONS:\n" + custom_instructions if custom_instructions else "")
|
||||
+ "\n\nIMPORTANT OUTPUT RULES:\n"
|
||||
"- Use the function call to return `return_code_review`: a list of tuples "
|
||||
" [line_number:int (1-based, GLOBAL), line_text:str, suggestion:str].\n"
|
||||
" [line_number:int (1-based, exactly same index as it was in the request per file), line_text:str, suggestion:str].\n"
|
||||
"- Only include tuples for lines with a concrete, actionable suggestion.\n"
|
||||
"- Keep suggestions concise and specific.\n"
|
||||
"- If many lines share the same issue, include a representative subset and list other line numbers.\n"
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ by celery daemon
|
|||
|
||||
import os
|
||||
import time
|
||||
from logging import Logger
|
||||
from typing import Any
|
||||
|
||||
from celery import current_app
|
||||
from pyramid_mailer.mailer import Mailer
|
||||
|
|
@ -31,6 +33,7 @@ from email.utils import formatdate
|
|||
|
||||
import rhodecode
|
||||
from rhodecode.apps.ai_agents.ai_service import get_ai_service
|
||||
from rhodecode.apps.ai_agents.models.base import Response
|
||||
from rhodecode.lib import audit_logger, diffs, codeblocks
|
||||
from rhodecode.lib.celerylib import get_logger, async_task, RequestContextTask, run_task
|
||||
from rhodecode.lib import hooks_base
|
||||
|
|
@ -518,6 +521,10 @@ def start_ai_code_review(pull_request_id):
|
|||
instructions = instructions.app_settings_value.split("\r\n")
|
||||
|
||||
response = service.code_review(diffset, instructions=instructions)
|
||||
_add_comments(response, pull_request, log)
|
||||
|
||||
|
||||
def _add_comments(response: Response, pull_request: PullRequest, log: Logger | Any):
|
||||
log.debug(
|
||||
"Response from AI service: %s",
|
||||
response.message,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue