mattzcarey / code-review-gpt

Code review powered by LLMs (OpenAI GPT4, Sonnet 3.5) & Embeddings ⚡️ Improve code quality and catch bugs before you break production 🚀 Lives in your Github/GitLab/Azure DevOps CI
https://oriontools.ai
MIT License
1.6k stars 162 forks source link

[BUG] <File are larger than the max prompt length> #327

Open dingli-pacvue opened 8 months ago

dingli-pacvue commented 8 months ago

ERROR Changes to file xxxx.java are larger than the max prompt length, consider using a model with a larger context window. Skipping file changes... Run npx code-review-gpt review --ci=github --model=gpt-3.5-turbo-16k --debug DEBUG Args: {"_":["review"],"ci":"github","model":"gpt-3.5-turbo-16k","debug":true,"setupTarget":"github","setup-target":"github","commentPerFile":false,"comment-per-file":false,"reviewType":"changed","review-type":"changed","provider":"openai","$0":"node_modules/.bin/code-review-gpt"}

we have use gpt-3.5-turbo-16k, but file is easy more than 16k, we only want to compare changes content. how to set?

my yml:

name: Code Review GPT

on: pull_request: branches:

permissions: id-token: write pull-requests: write contents: read actions: read

jobs: code-review-gpt: runs-on: ubuntu-latest

steps:
  - uses: actions/checkout@v4
    with:
      fetch-depth: 0

  - uses: actions/setup-node@v3
    with:
      node-version: 18

  - name: Install code-review-gpt
    run: npm install code-review-gpt

  - name: Run code review script
    run: npx code-review-gpt review --ci=github --model=gpt-3.5-turbo-16k --debug
    env:
      GITHUB_TOKEN: ${{ github.token }}
      BASE_SHA: ${{ github.event.pull_request.base.sha }}
      GITHUB_SHA: ${{ github.sha }}
      OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
dingli-pacvue commented 8 months ago

now have an other issues

ERROR Error parsing JSON response from the model: [{"fileName":"/home/runner/work/commerceapi-1p/commerceapi-1p/commerce/src/main/java/com/pacvue/commerce/commerce/controller/catalog/CatalogController.java","promptContent":"package com.pacvue.commerce.commerce.controller.catalog;\n+\nimport cn.hutool.core.collection.CollUtil;\nimport cn.hutool.core.collection.CollectionUtil;\nimport com.alibaba.fastjson.JSONObject;\nimport com.github.pagehelper.PageInfo;\nimport com.github.pagehelper.PageSerializable;\nimport com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;\nimport com.pacvue.commerce.commerce.config.SecurityContextHelper;\nimport com.pacvue.commerce.commercesdkfeign.dto.catalog.GetCatalogItemReqDto;\nimport com.pacvue.commerce.common.base.ApiConsts;\nimport com.pacvue.commerce.common.base.BaseResponse;\nimport com.pacvue.commerce.common.base.BaseUser;\nimport com.pacvue.commerce.common.exception.BusinessException;\nimport com.pacvue.commerce.common.methods.Common SyntaxError Unexpected end of JSON input error stack: •

• index.js Ge /node_modules/code-review-gpt/dist/index.js:16 • index.js maxTry /node_modules/code-review-gpt/dist/index.js:16 • task_queues process.processTicksAndRejections internal/process/task_queues:95 ERROR Error in callModelJSON