|
""" |
|
This is the Continue configuration file. |
|
|
|
See https://continue.dev/docs/customization to learn more. |
|
""" |
|
|
|
import subprocess |
|
|
|
from continuedev.src.continuedev.core.main import Step |
|
from continuedev.src.continuedev.core.sdk import ContinueSDK |
|
from continuedev.src.continuedev.core.models import Models |
|
from continuedev.src.continuedev.core.config import CustomCommand, SlashCommand, ContinueConfig |
|
from continuedev.src.continuedev.plugins.context_providers.github import GitHubIssuesContextProvider |
|
from continuedev.src.continuedev.plugins.context_providers.google import GoogleContextProvider |
|
from continuedev.src.continuedev.plugins.policies.default import DefaultPolicy |
|
from continuedev.src.continuedev.libs.llm.openai import OpenAI, OpenAIServerInfo |
|
from continuedev.src.continuedev.libs.llm.ggml import GGML |
|
|
|
from continuedev.src.continuedev.plugins.steps.open_config import OpenConfigStep |
|
from continuedev.src.continuedev.plugins.steps.clear_history import ClearHistoryStep |
|
from continuedev.src.continuedev.plugins.steps.feedback import FeedbackStep |
|
from continuedev.src.continuedev.plugins.steps.comment_code import CommentCodeStep |
|
from continuedev.src.continuedev.plugins.steps.share_session import ShareSessionStep |
|
from continuedev.src.continuedev.plugins.steps.main import EditHighlightedCodeStep |
|
from continuedev.src.continuedev.plugins.context_providers.search import SearchContextProvider |
|
from continuedev.src.continuedev.plugins.context_providers.diff import DiffContextProvider |
|
from continuedev.src.continuedev.plugins.context_providers.url import URLContextProvider |
|
|
|
class CommitMessageStep(Step): |
|
""" |
|
This is a Step, the building block of Continue. |
|
It can be used below as a slash command, so that |
|
run will be called when you type '/commit'. |
|
""" |
|
async def run(self, sdk: ContinueSDK): |
|
|
|
|
|
dir = sdk.ide.workspace_directory |
|
|
|
|
|
diff = subprocess.check_output( |
|
["git", "diff"], cwd=dir).decode("utf-8") |
|
|
|
|
|
|
|
self.description = await sdk.models.default.complete( |
|
f"{diff}\n\nWrite a short, specific (less than 50 chars) commit message about the above changes:") |
|
|
|
|
|
config = ContinueConfig( |
|
|
|
|
|
|
|
allow_anonymous_telemetry=True, |
|
|
|
models = Models( |
|
default = OpenAI( |
|
api_key = "my-api-key", |
|
model = "gpt-3.5-turbo", |
|
openai_server_info = OpenAIServerInfo( |
|
api_base = "http://localhost:8080", |
|
model = "gpt-3.5-turbo" |
|
) |
|
) |
|
), |
|
|
|
|
|
system_message=None, |
|
|
|
|
|
|
|
temperature=0.5, |
|
|
|
|
|
|
|
|
|
custom_commands=[ |
|
|
|
|
|
|
|
|
|
|
|
], |
|
|
|
|
|
slash_commands=[ |
|
|
|
|
|
|
|
|
|
|
|
SlashCommand( |
|
name="edit", |
|
description="Edit code in the current file or the highlighted code", |
|
step=EditHighlightedCodeStep, |
|
), |
|
SlashCommand( |
|
name="config", |
|
description="Customize Continue - slash commands, LLMs, system message, etc.", |
|
step=OpenConfigStep, |
|
), |
|
SlashCommand( |
|
name="comment", |
|
description="Write comments for the current file or highlighted code", |
|
step=CommentCodeStep, |
|
), |
|
SlashCommand( |
|
name="feedback", |
|
description="Send feedback to improve Continue", |
|
step=FeedbackStep, |
|
), |
|
SlashCommand( |
|
name="clear", |
|
description="Clear step history", |
|
step=ClearHistoryStep, |
|
), |
|
SlashCommand( |
|
name="share", |
|
description="Download and share the session transcript", |
|
step=ShareSessionStep, |
|
) |
|
], |
|
|
|
|
|
|
|
|
|
|
|
context_providers=[ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SearchContextProvider(), |
|
DiffContextProvider(), |
|
URLContextProvider( |
|
preset_urls = [ |
|
|
|
] |
|
) |
|
], |
|
|
|
|
|
|
|
policy=DefaultPolicy() |
|
) |
|
|