refactor(git,commitGenerator): add git context with stat and improve prompt structure
- introduce `getGitContext` returning both diff and name-status stat output - update `generateForRepository` and `performGeneration` to consume new context - prefix prompt with changed files stat block when available - replace `commitStyle` config key with `promptVersion` using `LATEST_PROMPT_VERSION` - fix first-commit diff logic to use else-branch instead of fallthrough checks - update extension icon
This commit is contained in:
+3
-3
@@ -1,5 +1,5 @@
|
||||
import * as vscode from "vscode"
|
||||
import { SYSTEM_PROMPT, CONVENTIONAL_INSTRUCTION, SIMPLE_INSTRUCTION } from "./prompts"
|
||||
import { SYSTEM_PROMPT, getPrompt } from "./prompts"
|
||||
|
||||
export interface AIProvider {
|
||||
generateCommitMessage(diff: string, style: string, signal: AbortSignal): AsyncIterable<string>
|
||||
@@ -15,7 +15,7 @@ class OpenAICompatibleProvider implements AIProvider {
|
||||
) {}
|
||||
|
||||
async *generateCommitMessage(diff: string, style: string, signal: AbortSignal): AsyncIterable<string> {
|
||||
const instruction = style === "conventional" ? CONVENTIONAL_INSTRUCTION : SIMPLE_INSTRUCTION
|
||||
const instruction = getPrompt(style)
|
||||
const url = `${this.baseUrl}/chat/completions`
|
||||
|
||||
const response = await fetch(url, {
|
||||
@@ -58,7 +58,7 @@ class AnthropicProvider implements AIProvider {
|
||||
) {}
|
||||
|
||||
async *generateCommitMessage(diff: string, style: string, signal: AbortSignal): AsyncIterable<string> {
|
||||
const instruction = style === "conventional" ? CONVENTIONAL_INSTRUCTION : SIMPLE_INSTRUCTION
|
||||
const instruction = getPrompt(style)
|
||||
const url = `${this.baseUrl}/messages`
|
||||
|
||||
const response = await fetch(url, {
|
||||
|
||||
Reference in New Issue
Block a user