mirror of
https://github.com/hustcer/deepseek-review.git
synced 2026-05-13 05:16:05 +08:00
Compare commits
2 Commits
feature/pr
...
v1.18
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9852113028 | ||
|
|
9ad3373cd5 |
1
.github/workflows/tests.yml
vendored
1
.github/workflows/tests.yml
vendored
@@ -15,6 +15,7 @@ on:
|
||||
branches:
|
||||
- main
|
||||
- develop
|
||||
- feature/test
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
- 'docs/**'
|
||||
|
||||
15
CHANGELOG.md
15
CHANGELOG.md
@@ -1,6 +1,21 @@
|
||||
# Changelog
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## [1.18.0] - 2025-06-11
|
||||
|
||||
### Features
|
||||
|
||||
- Set default `temperature` to **0.3** for code review (#181)
|
||||
|
||||
### Miscellaneous Tasks
|
||||
|
||||
- Refine diff flag descriptions in docs and scripts (#177)
|
||||
- Upgrade `Nu` to 0.105 and pin [`hustcer/setup-nu`](https://github.com/hustcer/setup-nu) to v3.19 (#183)
|
||||
|
||||
### Deps
|
||||
|
||||
- Upgrade `nutest` to v1.1.0 (#179)
|
||||
|
||||
## [1.17.0] - 2025-04-11
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
@@ -58,9 +58,9 @@ runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- name: Setup Nu
|
||||
uses: hustcer/setup-nu@v3
|
||||
uses: hustcer/setup-nu@v3.19
|
||||
with:
|
||||
version: 0.103.0
|
||||
version: 0.105.0
|
||||
|
||||
- name: DeepSeek Code Review
|
||||
shell: nu {0}
|
||||
|
||||
4
cr
4
cr
@@ -21,8 +21,8 @@ def main [
|
||||
--model(-m): string, # Model name, or read from CHAT_MODEL env var, `deepseek-chat` by default
|
||||
--base-url(-b): string, # DeepSeek API base URL, fallback to BASE_URL env var
|
||||
--chat-url(-U): string, # DeepSeek Model chat full API URL, e.g. http://localhost:11535/api/chat
|
||||
--sys-prompt(-s): string # Optional, System prompt message, fallback to SYSTEM_PROMPT env var
|
||||
--user-prompt(-u): string # Default to $DEFAULT_OPTIONS.USER_PROMPT
|
||||
--sys-prompt(-s): string # Default to $DEFAULT_OPTIONS.SYS_PROMPT,
|
||||
--user-prompt(-u): string # Default to $DEFAULT_OPTIONS.USER_PROMPT,
|
||||
--include(-i): string, # Comma separated file patterns to include in the code review
|
||||
--exclude(-x): string, # Comma separated file patterns to exclude in the code review
|
||||
--temperature(-T): float, # Temperature for the model, between `0` and `2`, default value `0.3`
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "deepseek-review",
|
||||
"version": "1.17.0",
|
||||
"actionVer": "v1.17",
|
||||
"version": "1.18.0",
|
||||
"actionVer": "v1.18",
|
||||
"author": "hustcer",
|
||||
"license": "MIT",
|
||||
"github": "https://github.com/hustcer/deepseek-review",
|
||||
|
||||
@@ -102,7 +102,7 @@ export def 'from env' []: string -> record {
|
||||
# Compact the record by removing empty columns
|
||||
export def compact-record []: record -> record {
|
||||
let record = $in
|
||||
let empties = $record | columns | filter {|it| $record | get $it | is-empty }
|
||||
let empties = $record | columns | where {|it| $record | get $it | is-empty }
|
||||
$record | reject ...$empties
|
||||
}
|
||||
|
||||
|
||||
@@ -23,8 +23,7 @@ def file-exists [file: string] {
|
||||
# Check if the prompt keys exist in the config.yml file
|
||||
def check-prompts [options: record] {
|
||||
check-prompt $options user
|
||||
# System prompt is optional, so we don't exit if it's missing
|
||||
# check-prompt $options system
|
||||
check-prompt $options system
|
||||
}
|
||||
|
||||
# Check if the specified type of prompt key exists in the config.yml file
|
||||
@@ -61,7 +60,7 @@ def check-providers [options: record] {
|
||||
}
|
||||
# Each provider should have name, token and models field
|
||||
$options.providers | each {|it|
|
||||
let empties = [name token models] | filter { |field| $it | get -i $field | is-empty }
|
||||
let empties = [name token models] | where { |field| $it | get -i $field | is-empty }
|
||||
if ($empties | is-not-empty) {
|
||||
print $'Field (ansi r)`($empties | str join ,)`(ansi reset) should not be empty for provider:'
|
||||
$it | table -e -t psql | print
|
||||
|
||||
16
nu/review.nu
16
nu/review.nu
@@ -46,7 +46,8 @@ const DEFAULT_OPTIONS = {
|
||||
MODEL: 'deepseek-chat',
|
||||
TEMPERATURE: 0.3,
|
||||
BASE_URL: 'https://api.deepseek.com',
|
||||
USER_PROMPT: 'You are a professional code review assistant responsible for analyzing code changes. Identify potential issues such as code style violations, logical errors, security vulnerabilities, and provide improvement suggestions. Clearly list the problems and recommendations in a concise manner. Please review the following code changes:',
|
||||
USER_PROMPT: 'Please review the following code changes:',
|
||||
SYS_PROMPT: 'You are a professional code review assistant responsible for analyzing code changes in GitHub Pull Requests. Identify potential issues such as code style violations, logical errors, security vulnerabilities, and provide improvement suggestions. Clearly list the problems and recommendations in a concise manner.',
|
||||
}
|
||||
|
||||
# Use DeepSeek AI to review code changes locally or in GitHub Actions
|
||||
@@ -64,8 +65,8 @@ export def --env deepseek-review [
|
||||
--model(-m): string, # Model name, or read from CHAT_MODEL env var, `deepseek-chat` by default
|
||||
--base-url(-b): string, # DeepSeek API base URL, fallback to BASE_URL env var
|
||||
--chat-url(-U): string, # DeepSeek Model chat full API URL, e.g. http://localhost:11535/api/chat
|
||||
--sys-prompt(-s): string # Optional, System prompt message, fallback to SYSTEM_PROMPT env var
|
||||
--user-prompt(-u): string # Default to $DEFAULT_OPTIONS.USER_PROMPT
|
||||
--sys-prompt(-s): string # Default to $DEFAULT_OPTIONS.SYS_PROMPT,
|
||||
--user-prompt(-u): string # Default to $DEFAULT_OPTIONS.USER_PROMPT,
|
||||
--include(-i): string, # Comma separated file patterns to include in the code review
|
||||
--exclude(-x): string, # Comma separated file patterns to exclude in the code review
|
||||
--temperature(-T): float, # Temperature for the model, between `0` and `2`, default value `0.3`
|
||||
@@ -125,15 +126,16 @@ export def --env deepseek-review [
|
||||
exit $ECODE.SUCCESS
|
||||
}
|
||||
print $'Review content length: (ansi g)($length)(ansi reset), current max length: (ansi g)($max_length)(ansi reset)'
|
||||
let sys_prompt = $sys_prompt | default $env.SYSTEM_PROMPT?
|
||||
let sys_prompt = $sys_prompt | default $env.SYSTEM_PROMPT? | default $DEFAULT_OPTIONS.SYS_PROMPT
|
||||
let user_prompt = $user_prompt | default $env.USER_PROMPT? | default $DEFAULT_OPTIONS.USER_PROMPT
|
||||
mut messages = if ($sys_prompt | is-empty) { [] } else { [{ role: 'system', content: $sys_prompt }] }
|
||||
$messages = $messages | append { role: 'user', content: $"($user_prompt)\n($content)" }
|
||||
let payload = {
|
||||
model: $model,
|
||||
stream: $stream,
|
||||
messages: $messages
|
||||
temperature: $temperature,
|
||||
messages: [
|
||||
{ role: 'system', content: $sys_prompt },
|
||||
{ role: 'user', content: $"($user_prompt):\n($content)" }
|
||||
]
|
||||
}
|
||||
if $debug { print $'(char nl)Code Changes:'; hr-line; print $content }
|
||||
print $'(char nl)Waiting for response from (ansi g)($url)(ansi reset) ...'
|
||||
|
||||
Reference in New Issue
Block a user