text
stringlengths
7
1.68M
id
stringlengths
17
99
metadata
dict
__index_level_0__
int64
0
33
description: rewrite selected code. hint: question input: required steps: - run: $devchat_python $command_path/rewrite.py "$input"
LabWorkflows/rewrite/command.yml/0
{ "file_path": "LabWorkflows/rewrite/command.yml", "repo_id": "LabWorkflows", "token_count": 40 }
5
print('{ "temperature": 22, "unit": "celsius", "description": "Sunny" }')
LabWorkflows/weather/weather.py/0
{ "file_path": "LabWorkflows/weather/weather.py", "repo_id": "LabWorkflows", "token_count": 27 }
6
<project version="4"> <component name="ExternalStorageConfigurationManager" enabled="true" /> <component name="FrameworkDetectionExcludesConfiguration"> <file type="web" url="file://$PROJECT_DIR$" /> </component> <component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-...
devchat-intellij/.idea/misc.xml/0
{ "file_path": "devchat-intellij/.idea/misc.xml", "repo_id": "devchat-intellij", "token_count": 114 }
7
distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists
devchat-intellij/gradle/wrapper/gradle-wrapper.properties/0
{ "file_path": "devchat-intellij/gradle/wrapper/gradle-wrapper.properties", "repo_id": "devchat-intellij", "token_count": 71 }
8
package ai.devchat.core import ai.devchat.common.* import ai.devchat.common.Notifier import ai.devchat.plugin.currentProject import ai.devchat.plugin.ideServerPort import ai.devchat.storage.CONFIG import com.alibaba.fastjson.JSON import com.alibaba.fastjson.JSONArray import com.alibaba.fastjson.JSONObject import com.i...
devchat-intellij/src/main/kotlin/ai/devchat/core/DevChatWrapper.kt/0
{ "file_path": "devchat-intellij/src/main/kotlin/ai/devchat/core/DevChatWrapper.kt", "repo_id": "devchat-intellij", "token_count": 4978 }
9
package ai.devchat.core.handlers import ai.devchat.core.BaseActionHandler import ai.devchat.core.DevChatActions import ai.devchat.plugin.currentProject import com.alibaba.fastjson.JSONObject import com.intellij.lang.Language import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.fileEdi...
devchat-intellij/src/main/kotlin/ai/devchat/core/handlers/NewSrcFile.kt/0
{ "file_path": "devchat-intellij/src/main/kotlin/ai/devchat/core/handlers/NewSrcFile.kt", "repo_id": "devchat-intellij", "token_count": 1886 }
10
package ai.devchat.plugin import ai.devchat.core.DevChatWrapper import com.intellij.ide.AppLifecycleListener class IDELifecycleListener: AppLifecycleListener { override fun appWillBeClosed(isRestart: Boolean) { super.appWillBeClosed(isRestart) DevChatWrapper.activeChannel?.close() } }
devchat-intellij/src/main/kotlin/ai/devchat/plugin/IDELifecycleListener.kt/0
{ "file_path": "devchat-intellij/src/main/kotlin/ai/devchat/plugin/IDELifecycleListener.kt", "repo_id": "devchat-intellij", "token_count": 118 }
11
package ai.devchat.storage import com.alibaba.fastjson.JSONObject object ActiveConversation { private var messages: MutableList<JSONObject>? = null var topic: String? = null fun reset(topic: String? = null, messages: List<JSONObject>? = null) { this.topic = topic this.messages = messages...
devchat-intellij/src/main/kotlin/ai/devchat/storage/ActiveConversation.kt/0
{ "file_path": "devchat-intellij/src/main/kotlin/ai/devchat/storage/ActiveConversation.kt", "repo_id": "devchat-intellij", "token_count": 580 }
12
import * as path from 'path'; import * as vscode from 'vscode'; import { ChatContext } from './contextManager'; import { logger } from '../util/logger'; import { handleCodeSelected } from './contextCodeSelected'; import { log } from 'console'; async function getSelectedSymbol(): Promise<vscode.DocumentSymbol | und...
devchat-vscode/src/context/contextDefRefs.ts/0
{ "file_path": "devchat-vscode/src/context/contextDefRefs.ts", "repo_id": "devchat-vscode", "token_count": 1102 }
13
import * as path from 'path'; import * as fsE from 'fs'; import fs from 'fs/promises'; import { logger } from '../../../util/logger'; import { getFileBlock } from '../symbolindex/embedding'; import { UiUtilWrapper } from '../../../util/uiUtil'; import { getLanguageFullName } from '../ast/language'; import { DevChatConf...
devchat-vscode/src/contributes/codecomplete/astIndex/index.ts/0
{ "file_path": "devchat-vscode/src/contributes/codecomplete/astIndex/index.ts", "repo_id": "devchat-vscode", "token_count": 2404 }
14
/* 记录最近修改的内容,用于代码补全 */ import { logger } from '../../util/logger'; import * as vscode from 'vscode'; import { collapseFile } from './ast/collapseBlock'; import { getCommentPrefix } from './ast/language'; export class RecentEdit { fileName: string; content: string; collapseContent: string; constructo...
devchat-vscode/src/contributes/codecomplete/recentEdits.ts/0
{ "file_path": "devchat-vscode/src/contributes/codecomplete/recentEdits.ts", "repo_id": "devchat-vscode", "token_count": 1146 }
15
import { regInMessage, regOutMessage } from '../util/reg_messages';
devchat-vscode/src/handler/contextDetail.ts/0
{ "file_path": "devchat-vscode/src/handler/contextDetail.ts", "repo_id": "devchat-vscode", "token_count": 22 }
16
import * as vscode from 'vscode'; import { MessageHandler } from './messageHandler'; import { regInMessage, regOutMessage } from '../util/reg_messages'; import { ApiKeyManager } from '../util/apiKey'; import DevChat from '../toolwrapper/devchat'; export interface Command { name: string; pattern: string; descriptio...
devchat-vscode/src/handler/workflowCommandHandler.ts/0
{ "file_path": "devchat-vscode/src/handler/workflowCommandHandler.ts", "repo_id": "devchat-vscode", "token_count": 672 }
17
/** * Type definitions for IDE Service Protocol */ export namespace IDEService { export type LogLevel = "info" | "warn" | "error" | "debug"; export interface Position { line: number; // 0-based character: number; // 0-based } export interface Range { start: Position; ...
devchat-vscode/src/ide_services/types.ts/0
{ "file_path": "devchat-vscode/src/ide_services/types.ts", "repo_id": "devchat-vscode", "token_count": 230 }
18
export class FilePairManager { private static instance: FilePairManager; private filePairs: Map<string, [string, string]>; private constructor() { this.filePairs = new Map<string, [string, string]>(); } static getInstance(): FilePairManager { if (!FilePairManager.instance) { FilePairManager.i...
devchat-vscode/src/util/diffFilePairs.ts/0
{ "file_path": "devchat-vscode/src/util/diffFilePairs.ts", "repo_id": "devchat-vscode", "token_count": 259 }
19
# Why conda? Devchat-vscode support custom extension. Different extension may need different python version. pyenv is also a python version manager, but it always download source of python, then build it to binary. conda is a package manager, it can download binary of python, and install packages. # Where to install...
devchat-vscode/src/util/python_installer/readme.md/0
{ "file_path": "devchat-vscode/src/util/python_installer/readme.md", "repo_id": "devchat-vscode", "token_count": 106 }
20
import { expect } from 'chai'; import { describe, it } from 'mocha'; describe('yourFunction', () => { it('should return the correct result for input 1', () => { const input = 1; const expectedResult = 'expectedResult'; const result = 'expectedResult'; expect(result).to.equal(expectedResult); }); ...
devchat-vscode/test/util/utils.test.ts/0
{ "file_path": "devchat-vscode/test/util/utils.test.ts", "repo_id": "devchat-vscode", "token_count": 109 }
21
import click from .main import main as main_from_argparse # 导入修改后的main函数 @click.command(context_settings={ "ignore_unknown_options": True, "allow_extra_args": True }) @click.pass_context def click_main(ctx): """调用基于argparse的CLI程序,传递参数列表。""" main_from_argparse(ctx.args)
devchat/devchat/_cli/click_main.py/0
{ "file_path": "devchat/devchat/_cli/click_main.py", "repo_id": "devchat", "token_count": 146 }
22
from .service import IDEService from .types import * from .types import __all__ as types_all __all__ = types_all + [ "IDEService", ]
devchat/devchat/ide/__init__.py/0
{ "file_path": "devchat/devchat/ide/__init__.py", "repo_id": "devchat", "token_count": 49 }
23
from .openai_chat import OpenAIChatParameters, OpenAIChatConfig, OpenAIChat from .openai_message import OpenAIMessage from .openai_prompt import OpenAIPrompt __all__ = [ 'OpenAIChat', 'OpenAIChatConfig', 'OpenAIChatParameters', 'OpenAIMessage', 'OpenAIPrompt' ]
devchat/devchat/openai/__init__.py/0
{ "file_path": "devchat/devchat/openai/__init__.py", "repo_id": "devchat", "token_count": 104 }
24
{ "choices": [ { "delta": { "content": "Tomorrow" }, "finish_reason": null, "index": 0 } ], "created": 1682163460, "id": "chatcmpl-785qeSHlUo3lH4OnLuovtk3NqLcD6", "model": "gpt-3.5-turbo-0301", "object": "chat.comple...
devchat/tests/stream_responses/response2.json/0
{ "file_path": "devchat/tests/stream_responses/response2.json", "repo_id": "devchat", "token_count": 208 }
25
from typing import Tuple import pytest from devchat.openai import OpenAIChatConfig, OpenAIChat from devchat.store import Store @pytest.fixture(name="chat_store", scope="function") def create_chat_store(tmp_path) -> Tuple[OpenAIChat, Store]: config = OpenAIChatConfig(model="gpt-3.5-turbo") chat = OpenAIChat(co...
devchat/tests/test_store.py/0
{ "file_path": "devchat/tests/test_store.py", "repo_id": "devchat", "token_count": 2706 }
26
import os import re import sys from devchat.ide.service import IDEService from devchat.ide.vscode_services import selected_lines, visible_lines from devchat.llm import chat def get_selected_code(): """ Retrieves the selected lines of code from the user's selection. This function extracts the text select...
workflows/comments/main.py/0
{ "file_path": "workflows/comments/main.py", "repo_id": "workflows", "token_count": 1652 }
27
import os import sys from typing import Optional import click from chat.ask_codebase.assistants.directory_structure.repo_explainer import ( RepoStructureExplainer, ) sys.path.append(os.path.join(os.path.dirname(__file__), "..", "libs")) from chatmark import Step # noqa: E402 Languages = { "en": "English", ...
workflows/expl_struct/main.py/0
{ "file_path": "workflows/expl_struct/main.py", "repo_id": "workflows", "token_count": 389 }
28
### 操作指南 使用代码重构,请按照如下步骤操作: 1. 选中行间代码。 2. 输入\/refactor.names,回车发送。 3. 开始生成代码,等待生成结束。 4. 自动弹出Diff View,选择是否接受修改。 如图所示: ![图片](https://deploy-script.merico.cn/devchat/workflow/readme_refactor.names.gif)
workflows/refactor/README.md/0
{ "file_path": "workflows/refactor/README.md", "repo_id": "workflows", "token_count": 213 }
29
description: Generate unit tests. input: required steps: - run: $devchat_python $command_path/main.py "$input"
workflows/unit_tests/command.yml/0
{ "file_path": "workflows/unit_tests/command.yml", "repo_id": "workflows", "token_count": 35 }
30
from abc import ABC, abstractmethod from collections import defaultdict from pathlib import Path from typing import Callable, List, Optional from tools.file_util import is_not_hidden, is_source_code from tools.git_util import git_file_of_interest_filter class DirectoryViewer(ABC): def __init__( self, ...
workflows/unit_tests/tools/directory_viewer.py/0
{ "file_path": "workflows/unit_tests/tools/directory_viewer.py", "repo_id": "workflows", "token_count": 1786 }
31
prompts: [ '../../diffCommitMessagePrompt.txt' ] providers: - id: "exec:python commit_message_run.py" tests: - commit_message_tests.yaml
LabWorkflows/git/commit/test/prompt/commit_message_prompt_config.yaml/0
{ "file_path": "LabWorkflows/git/commit/test/prompt/commit_message_prompt_config.yaml", "repo_id": "LabWorkflows", "token_count": 62 }
0
description: 'Create new branch based current branch, and checkout new branch.' input: required steps: - run: $devchat_python $command_path/command.py "$input"
LabWorkflows/git/new_branch/command.yml/0
{ "file_path": "LabWorkflows/git/new_branch/command.yml", "repo_id": "LabWorkflows", "token_count": 43 }
1
description: 'LLM Model test' input: required steps: - run: $command_python $command_path/command.py "$input" "nochat"
LabWorkflows/llm/command.yml/0
{ "file_path": "LabWorkflows/llm/command.yml", "repo_id": "LabWorkflows", "token_count": 39 }
2
""" /pr.describe https://github.com/devchat-ai/devchat-vscode/pull/25 """ import os import sys import logging import json import argparse import asyncio # add the current directory to the path from os.path import dirname, abspath sys.path.append(dirname(dirname(abspath(__file__)))) # add new model configs to algo.MA...
LabWorkflows/pr/command.py/0
{ "file_path": "LabWorkflows/pr/command.py", "repo_id": "LabWorkflows", "token_count": 1741 }
3
description: ask tasks. hint: question input: required steps: - run: $devchat_python $command_path/../command.py "$input" "ask"
LabWorkflows/task/ask/command.yml/0
{ "file_path": "LabWorkflows/task/ask/command.yml", "repo_id": "LabWorkflows", "token_count": 42 }
4
description: edit workflow. input: optional steps: - run: $devchat_python $command_path/command.py
LabWorkflows/workflow/edit/command.yml/0
{ "file_path": "LabWorkflows/workflow/edit/command.yml", "repo_id": "LabWorkflows", "token_count": 30 }
5
## Chat Message ### JS to Java ```json { "action": "sendMessage/request", "metadata": { "callback": "responseFunctionName", "parent": "b67937dd845afdf59dec505efafd2d18854cb2b147ae0cecd7f266d856373137" }, "payload": { "contexts": [ { "type": "code", "languageId": "python", ...
devchat-intellij/api/chat.md/0
{ "file_path": "devchat-intellij/api/chat.md", "repo_id": "devchat-intellij", "token_count": 959 }
6
package ai.devchat.common import com.intellij.AbstractBundle import org.jetbrains.annotations.NonNls import org.jetbrains.annotations.PropertyKey const val BUNDLE = "messages.DevChatBundle" object DevChatBundle : AbstractBundle(BUNDLE) { @JvmStatic fun message(@PropertyKey(resourceBundle = BUNDLE) key: String, v...
devchat-intellij/src/main/kotlin/ai/devchat/common/DevChatBundle.kt/0
{ "file_path": "devchat-intellij/src/main/kotlin/ai/devchat/common/DevChatBundle.kt", "repo_id": "devchat-intellij", "token_count": 148 }
7
package ai.devchat.core.handlers import ai.devchat.core.BaseActionHandler import ai.devchat.core.DevChatActions import ai.devchat.storage.DevChatState import com.alibaba.fastjson.JSONObject class DeleteTopicRequestHandler(requestAction: String, metadata: JSONObject?, payload: JSONObject?) : BaseActionHandler( req...
devchat-intellij/src/main/kotlin/ai/devchat/core/handlers/DeleteTopicRequestHandler.kt/0
{ "file_path": "devchat-intellij/src/main/kotlin/ai/devchat/core/handlers/DeleteTopicRequestHandler.kt", "repo_id": "devchat-intellij", "token_count": 273 }
8
package ai.devchat.core.handlers import ai.devchat.core.BaseActionHandler import ai.devchat.core.DevChatActions import ai.devchat.storage.SensitiveDataStorage import com.alibaba.fastjson.JSONObject class SetOrUpdateKeyRequestHandler(requestAction: String, metadata: JSONObject?, payload: JSONObject?) : BaseActionHandl...
devchat-intellij/src/main/kotlin/ai/devchat/core/handlers/SetOrUpdateKeyRequestHandler.kt/0
{ "file_path": "devchat-intellij/src/main/kotlin/ai/devchat/core/handlers/SetOrUpdateKeyRequestHandler.kt", "repo_id": "devchat-intellij", "token_count": 256 }
9
package ai.devchat.plugin.actions import ai.devchat.common.DevChatBundle import ai.devchat.plugin.DevChatToolWindow import ai.devchat.storage.CONFIG import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnAction import com.intellij.openapi.actionSystem.AnActionEvent impor...
devchat-intellij/src/main/kotlin/ai/devchat/plugin/actions/AddToDevChatFileAction.kt/0
{ "file_path": "devchat-intellij/src/main/kotlin/ai/devchat/plugin/actions/AddToDevChatFileAction.kt", "repo_id": "devchat-intellij", "token_count": 931 }
10
<!-- Plugin Configuration File. Read more: https://plugins.jetbrains.com/docs/intellij/plugin-configuration-file.html --> <idea-plugin> <!-- Unique identifier of the plugin. It should be FQN. It cannot be changed between the plugin versions. --> <id>ai.devchat.plugin</id> <!-- Public plugin name should be ...
devchat-intellij/src/main/resources/META-INF/plugin.xml/0
{ "file_path": "devchat-intellij/src/main/resources/META-INF/plugin.xml", "repo_id": "devchat-intellij", "token_count": 2062 }
11
import * as vscode from 'vscode'; import * as path from 'path'; import { ChatContext } from './contextManager'; import { logger } from '../util/logger'; import { handleCodeSelected } from './contextCodeSelected'; import DevChat, { ChatOptions } from '../toolwrapper/devchat'; import { UiUtilWrapper } from '../util/uiU...
devchat-vscode/src/context/contextRefDefs.ts/0
{ "file_path": "devchat-vscode/src/context/contextRefDefs.ts", "repo_id": "devchat-vscode", "token_count": 4359 }
12
/* 对实时返回的chunk进行过滤,判断当前是否已经满足停止条件,避免无效代码占用补全时间 */ import * as vscode from 'vscode'; import { logger } from '../../util/logger'; import { CodeCompletionChunk, streamComplete } from './llm'; import { getCommentPrefix } from './ast/language'; // 代码补全返回结果定义 export interface CodeCompleteResult { prompt: string; ...
devchat-vscode/src/contributes/codecomplete/chunkFilter.ts/0
{ "file_path": "devchat-vscode/src/contributes/codecomplete/chunkFilter.ts", "repo_id": "devchat-vscode", "token_count": 5611 }
13
import * as vscode from "vscode"; import * as fs from "fs"; import * as os from "os"; import * as path from "path"; import * as util from "util"; import { sendFileSelectMessage, sendCodeSelectMessage } from "./util"; import { ExtensionContextHolder } from "../util/extensionContext"; import { FilePairManager } from "../...
devchat-vscode/src/contributes/commands.ts/0
{ "file_path": "devchat-vscode/src/contributes/commands.ts", "repo_id": "devchat-vscode", "token_count": 4694 }
14
import * as vscode from 'vscode'; import { MessageHandler } from './messageHandler'; export async function focusDevChatInput(panel: vscode.WebviewPanel|vscode.WebviewView): Promise<void> { const inputFocusMessage = {"command": "focusDevChatInput"}; if (panel) { MessageHandler.sendMessage(panel, inputF...
devchat-vscode/src/handler/focusHandler.ts/0
{ "file_path": "devchat-vscode/src/handler/focusHandler.ts", "repo_id": "devchat-vscode", "token_count": 113 }
15
import * as vscode from "vscode"; import { IDEService } from "../types"; /** * Get document symbols of a file * * @param abspath: absolute path of the file * @returns an array of IDEService.SymbolNode */ export async function getDocumentSymbols( abspath: string ): Promise<IDEService.SymbolNode[]> { const...
devchat-vscode/src/ide_services/endpoints/getDocumentSymbols.ts/0
{ "file_path": "devchat-vscode/src/ide_services/endpoints/getDocumentSymbols.ts", "repo_id": "devchat-vscode", "token_count": 699 }
16
import * as fs from 'fs'; import * as path from 'path'; import { logger } from "../util/logger"; import { UiUtilWrapper } from "../util/uiUtil"; import { ApiKeyManager } from '../util/apiKey'; import { installDevchat } from '../util/python_installer/install_devchat'; let devchatStatus = ''; let apiKeyStatus = ''; l...
devchat-vscode/src/panel/statusBarViewBase.ts/0
{ "file_path": "devchat-vscode/src/panel/statusBarViewBase.ts", "repo_id": "devchat-vscode", "token_count": 615 }
17
import { LogChannel } from "./logger"; import * as vscode from 'vscode'; export class LoggerChannelVscode implements LogChannel { _channel: vscode.LogOutputChannel; private static _instance: LoggerChannelVscode; private constructor() { this._channel = vscode.window.createOutputChannel('DevChat', { log: tru...
devchat-vscode/src/util/logger_vscode.ts/0
{ "file_path": "devchat-vscode/src/util/logger_vscode.ts", "repo_id": "devchat-vscode", "token_count": 319 }
18
import { expect } from 'chai'; import CustomContexts from '../../src/context/customContext'; import fs from 'fs'; import path from 'path'; describe('CustomContexts', () => { const workflowsDir = path.join(__dirname, 'test-workflows'); beforeEach(() => { // Create a test workflows directory with a samp...
devchat-vscode/test/context/customContext.test.ts/0
{ "file_path": "devchat-vscode/test/context/customContext.test.ts", "repo_id": "devchat-vscode", "token_count": 528 }
19
{ "extends": "./tsconfig.json", "compilerOptions": { "rootDir": ".", "outDir": "out-test", "skipLibCheck": true }, "include": ["src/**/*.ts", "test/**/*.ts"] }
devchat-vscode/tsconfig.test.json/0
{ "file_path": "devchat-vscode/tsconfig.test.json", "repo_id": "devchat-vscode", "token_count": 77 }
20
# pylint: disable=import-outside-toplevel import sys from typing import List, Optional from .command import command, Command @command('prompt', help='Interact with the large language model (LLM).') @Command.argument('content') @Command.option('-p', '--parent', help='Input the parent prompt hash to continue the conve...
devchat/devchat/_cli/prompt.py/0
{ "file_path": "devchat/devchat/_cli/prompt.py", "repo_id": "devchat", "token_count": 1029 }
21
import yaml def _send_message(message): out_data = f"""\n{message}\n""" print(out_data, flush=True) def _parse_chatmark_response(response): # resonse looks like: """ ``` some_name some key name 1: value1 some key name 2: value2 ``` """ # parse key values lines = response....
devchat/devchat/chatmark/iobase.py/0
{ "file_path": "devchat/devchat/chatmark/iobase.py", "repo_id": "devchat", "token_count": 434 }
22
import os from .rpc import rpc_call from .types import LocationWithText @rpc_call def run_code(code: str): # pylint: disable=unused-argument pass @rpc_call def diff_apply(filepath, content): # pylint: disable=unused-argument pass @rpc_call def get_symbol_defines_in_selected_code(): pass def find_sy...
devchat/devchat/ide/vscode_services.py/0
{ "file_path": "devchat/devchat/ide/vscode_services.py", "repo_id": "devchat", "token_count": 2196 }
23
from abc import ABC, abstractmethod from dataclasses import dataclass, field, asdict import hashlib from datetime import datetime import sys from typing import Dict, List from devchat.message import Message from devchat.utils import unix_to_local_datetime, get_logger, user_id logger = get_logger(__name__) @dataclas...
devchat/devchat/prompt.py/0
{ "file_path": "devchat/devchat/prompt.py", "repo_id": "devchat", "token_count": 3924 }
24
{ "choices": [ { "delta": {}, "finish_reason": "stop", "index": 0 } ], "created": 1682163460, "id": "chatcmpl-785qeSHlUo3lH4OnLuovtk3NqLcD6", "model": "gpt-3.5-turbo-0301", "object": "chat.completion.chunk" }
devchat/tests/stream_responses/response7.json/0
{ "file_path": "devchat/tests/stream_responses/response7.json", "repo_id": "devchat", "token_count": 175 }
25
.PHONY: setup-dev check fix div = $(shell printf '=%.0s' {1..120}) setup-dev: @echo "Setting up development environment..." @echo "Installing dev dependencies..." @~/.chat/mamba/envs/devchat-commands/bin/pip install -r requirements-dev.txt @echo "Done!" check: @echo ${div} ~/.chat/mamba/envs/devchat-commands/b...
workflows/Makefile/0
{ "file_path": "workflows/Makefile", "repo_id": "workflows", "token_count": 247 }
26
### 操作指南 使用代码纠错,请按照如下步骤操作: 1. 选中行间代码。 2. 输入\/fix,回车发送;或右键点击**DevChat: Fix this**按钮。 3. 开始生成代码建议,等待生成结束。 4. 自动弹出Diff View,选择是否接受修改。 如图所示: ![图片](https://deploy-script.merico.cn/devchat/workflow/readme_fix.gif)
workflows/fix/README.md/0
{ "file_path": "workflows/fix/README.md", "repo_id": "workflows", "token_count": 242 }
27
import os import sys from .rpc import rpc_call @rpc_call def run_code(code: str): pass @rpc_call def diff_apply(filepath, content): pass @rpc_call def get_symbol_defines_in_selected_code(): pass def find_symbol(command, abspath, line, col): code = ( f"const position = new vscode.Positio...
workflows/libs/ide_services/vscode_services.py/0
{ "file_path": "workflows/libs/ide_services/vscode_services.py", "repo_id": "workflows", "token_count": 1609 }
28
# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-03-15 16...
workflows/unit_tests/locales/base.pot/0
{ "file_path": "workflows/unit_tests/locales/base.pot", "repo_id": "workflows", "token_count": 678 }
29
from functools import partial from typing import List, Optional from devchat.llm.chat import chat_completion_stream_out from find_context import Context from llm_conf import ( CONTEXT_SIZE, DEFAULT_CONTEXT_SIZE, DEFAULT_ENCODING, USE_USER_MODEL, USER_LLM_MODEL, ) from model import FuncToTest, Token...
workflows/unit_tests/write_tests.py/0
{ "file_path": "workflows/unit_tests/write_tests.py", "repo_id": "workflows", "token_count": 2305 }
30
import os import sys import json # home = os.path.expanduser("~") # org_libs_path = os.path.join(home, ".chat", "workflows", "org", "libs") # sys_libs_path = os.path.join(home, ".chat", "workflows", "sys", "libs") # sys.path.append(org_libs_path) # sys.path.append(sys_libs_path) from devchat.llm import chat from dev...
LabWorkflows/chat/command.py/0
{ "file_path": "LabWorkflows/chat/command.py", "repo_id": "LabWorkflows", "token_count": 258 }
0
import json import os import sys import requests def get_script_path(): """Return the directory path of the current script.""" return os.path.dirname(__file__) def update_sys_path(): """Extend system path to include library directories.""" libs_path = os.path.join(get_script_path(), "..", "..", ".....
LabWorkflows/git/commit/test/prompt/commit_message_run.py/0
{ "file_path": "LabWorkflows/git/commit/test/prompt/commit_message_run.py", "repo_id": "LabWorkflows", "token_count": 1266 }
1
import sys import os # Reuse the paths and imports from the context home = os.path.expanduser("~") org_libs_path = os.path.join(home, ".chat", "workflows", "org", "libs") sys_libs_path = os.path.join(home, ".chat", "workflows", "sys", "libs") sys.path.append(org_libs_path) sys.path.append(sys_libs_path) sys.path.appen...
LabWorkflows/git/new_issue/command.py/0
{ "file_path": "LabWorkflows/git/new_issue/command.py", "repo_id": "LabWorkflows", "token_count": 732 }
2
import sys import os import yaml home = os.path.expanduser("~") org_libs_path = os.path.join(home, ".chat", "workflows", "org", "libs") sys_libs_path = os.path.join(home, ".chat", "workflows", "sys", "libs") sys.path.append(org_libs_path) sys.path.append(sys_libs_path) script_path = os.path.dirname(os.path.abspath(...
LabWorkflows/llm/config/command.py/0
{ "file_path": "LabWorkflows/llm/config/command.py", "repo_id": "LabWorkflows", "token_count": 656 }
3
import os import json import sys from devchat.chatmark import TextEditor # 根据PR URL获取不同的仓库管理类型 # 支持的类型有:github gitlab bitbucket bitbucket_server azure codecommit gerrit def get_repo_type(url): # 根据URL的特征判断仓库管理类型 if "github.com" in url: return "github" elif "gitlab.com" in url or "/gitlab/" in url...
LabWorkflows/pr/config_util.py/0
{ "file_path": "LabWorkflows/pr/config_util.py", "repo_id": "LabWorkflows", "token_count": 924 }
4
# -*- coding: utf-8 -*- import datetime import json import os import sys import re import yaml import openai home = os.path.expanduser("~") org_libs_path = os.path.join(home, ".chat", "workflows", "org", "libs") sys_libs_path = os.path.join(home, ".chat", "workflows", "sys", "libs") sys.path.append(org_libs_path) sys...
LabWorkflows/task/command.py/0
{ "file_path": "LabWorkflows/task/command.py", "repo_id": "LabWorkflows", "token_count": 8925 }
5
""" 当前脚本用于实现 /workflow.local_install命令 具体步骤有: -> step1: 选择需要安装的command, 候选列表来自于~/.chat/workflows/usr下子目录列表 -> step2: 安装依赖环境。调用IDE服务,安装依赖环境,输入参数为command_name, requirements.txt文件路径。返回值为安装后的python路径。 -> step3: 更新command列表。调用IDE服务,更新command列表 """ import os import sys import hashlib import json sys.path.append(os.path.jo...
LabWorkflows/workflow/reinstalldeps/command.py/0
{ "file_path": "LabWorkflows/workflow/reinstalldeps/command.py", "repo_id": "LabWorkflows", "token_count": 1104 }
6
## Insert Code ### JS to Java ```json { "action": "insertCode/request", "metadata": { "callback": "responseFunctionName" }, "payload": { "content": "adkfjj\n" } } ``` ### Java to JS ```json { "action": "insertCode/response", "metadata": { "status": "success", "error": "" }, "payloa...
devchat-intellij/api/code-action.md/0
{ "file_path": "devchat-intellij/api/code-action.md", "repo_id": "devchat-intellij", "token_count": 368 }
7
package ai.devchat.common import com.intellij.openapi.diagnostic.LogLevel import com.intellij.openapi.diagnostic.Logger object Log { private val LOG = Logger.getInstance("DevChat") private const val PREFIX = "[DevChat] " private fun setLevel(level: LogLevel) { LOG.setLevel(level) } @JvmSt...
devchat-intellij/src/main/kotlin/ai/devchat/common/Log.kt/0
{ "file_path": "devchat-intellij/src/main/kotlin/ai/devchat/common/Log.kt", "repo_id": "devchat-intellij", "token_count": 354 }
8
package ai.devchat.core.handlers import ai.devchat.core.BaseActionHandler import ai.devchat.core.DevChatActions import ai.devchat.storage.SensitiveDataStorage import com.alibaba.fastjson.JSONObject class GetKeyRequestHandler(requestAction: String, metadata: JSONObject?, payload: JSONObject?) : BaseActionHandler( ...
devchat-intellij/src/main/kotlin/ai/devchat/core/handlers/GetKeyRequestHandler.kt/0
{ "file_path": "devchat-intellij/src/main/kotlin/ai/devchat/core/handlers/GetKeyRequestHandler.kt", "repo_id": "devchat-intellij", "token_count": 241 }
9
package ai.devchat.core.handlers import ai.devchat.core.BaseActionHandler import ai.devchat.core.DevChatActions import ai.devchat.plugin.currentProject import com.alibaba.fastjson.JSONObject import com.intellij.openapi.options.ShowSettingsUtil class ShowSettingDialogRequestHandler(requestAction: String, metadata: JS...
devchat-intellij/src/main/kotlin/ai/devchat/core/handlers/ShowSettingDialogRequestHandler.kt/0
{ "file_path": "devchat-intellij/src/main/kotlin/ai/devchat/core/handlers/ShowSettingDialogRequestHandler.kt", "repo_id": "devchat-intellij", "token_count": 202 }
10
package ai.devchat.plugin.actions import ai.devchat.common.DevChatBundle import ai.devchat.core.DevChatActions import ai.devchat.core.handlers.SendUserMessageHandler import ai.devchat.plugin.DevChatToolWindow import ai.devchat.storage.CONFIG import com.alibaba.fastjson.JSONObject import com.intellij.openapi.actionSyst...
devchat-intellij/src/main/kotlin/ai/devchat/plugin/actions/DocComments.kt/0
{ "file_path": "devchat-intellij/src/main/kotlin/ai/devchat/plugin/actions/DocComments.kt", "repo_id": "devchat-intellij", "token_count": 619 }
11
# Automated Publishing Process for DevChat VSCode Extension This document aims to explain the automated publishing process for our DevChat VSCode Extension. We use CircleCI for continuous integration and deployment to streamline the development and release process. ## Tagging Triggers Publishing Every time we are re...
devchat-vscode/docs/publish.md/0
{ "file_path": "devchat-vscode/docs/publish.md", "repo_id": "devchat-vscode", "token_count": 342 }
12
import fs from 'fs'; import path from 'path'; import { logger } from '../util/logger'; import { runCommandStringArrayAndWriteOutput, runCommandStringAndWriteOutputSync, CommandResult } from '../util/commonUtil'; import { UiUtilWrapper } from '../util/uiUtil'; export interface CustomContext { name: string; descript...
devchat-vscode/src/context/customContext.ts/0
{ "file_path": "devchat-vscode/src/context/customContext.ts", "repo_id": "devchat-vscode", "token_count": 1204 }
13
import * as vscode from 'vscode'; import { logger } from '../../util/logger'; import Debouncer from './debouncer'; import MemoryCacheManager from './cache'; import { createPrompt, findSimilarCodeBlock } from './promptCreator'; import { CodeCompleteResult, LLMStreamComplete } from './chunkFilter'; import { DevChatConfi...
devchat-vscode/src/contributes/codecomplete/codecomplete.ts/0
{ "file_path": "devchat-vscode/src/contributes/codecomplete/codecomplete.ts", "repo_id": "devchat-vscode", "token_count": 5210 }
14
// src/contributes/commandsBase.ts import { UiUtilWrapper } from "../util/uiUtil"; import { runCommand } from "../util/commonUtil"; import { logger } from "../util/logger"; import { DevChatConfig } from "../util/config"; let devchatStatus = ''; function locateCommand(command): string | undefined { try { // spli...
devchat-vscode/src/contributes/commandsBase.ts/0
{ "file_path": "devchat-vscode/src/contributes/commandsBase.ts", "repo_id": "devchat-vscode", "token_count": 508 }
15
import { messageHandler } from './messageHandler'; import { insertCodeBlockToFile } from './codeBlockHandler'; import { replaceCodeBlockToFile } from './codeBlockHandler'; import { doCommit } from './commitHandler'; import { getHistoryMessages } from './historyMessagesHandler'; import { getWorkflowCommandList } from '....
devchat-vscode/src/handler/handlerRegister.ts/0
{ "file_path": "devchat-vscode/src/handler/handlerRegister.ts", "repo_id": "devchat-vscode", "token_count": 1190 }
16
import { logger } from "../../util/logger"; export async function getServicePort() { logger .channel() ?.info(`get lsp bridge port: ${process.env.DEVCHAT_IDE_SERVICE_PORT}`); // return await UiUtilWrapper.getLSPBrigePort(); return process.env.DEVCHAT_IDE_SERVICE_PORT; }
devchat-vscode/src/ide_services/endpoints/getServicePort.ts/0
{ "file_path": "devchat-vscode/src/ide_services/endpoints/getServicePort.ts", "repo_id": "devchat-vscode", "token_count": 119 }
17
import * as vscode from 'vscode'; import * as path from 'path'; import * as fs from 'fs'; export default class WebviewManager { private _webview: vscode.Webview; private _extensionUri: vscode.Uri; constructor(webview: vscode.Webview, extensionUri: vscode.Uri) { this._webview = webview; this._extensionUri = ext...
devchat-vscode/src/panel/webviewManager.ts/0
{ "file_path": "devchat-vscode/src/panel/webviewManager.ts", "repo_id": "devchat-vscode", "token_count": 487 }
18
export class MessageHistory { private history: any[]; private lastmessage: any | null; private topic: string | null; constructor() { this.history = []; this.lastmessage = null; this.topic = null; } setTopic(topic: string) { this.topic = topic; } getTopic() { return this.topic; } add(message: an...
devchat-vscode/src/util/messageHistory.ts/0
{ "file_path": "devchat-vscode/src/util/messageHistory.ts", "repo_id": "devchat-vscode", "token_count": 344 }
19
import { expect } from 'chai'; // import { describe, it } from 'mocha'; import '../../src/context/loadContexts'; import { ChatContextManager } from '../../src/context/contextManager'; import { gitDiffCachedContext } from '../../src/context/contextGitDiffCached'; import { gitDiffContext } from '../../src/context/context...
devchat-vscode/test/context/loadContexts.test.ts/0
{ "file_path": "devchat-vscode/test/context/loadContexts.test.ts", "repo_id": "devchat-vscode", "token_count": 231 }
20
# Welcome to your VS Code Extension ## What's in the folder * This folder contains all of the files necessary for your extension. * `package.json` - this is the manifest file in which you declare your extension and command. * The sample plugin registers a command and defines its title and command name. With this in...
devchat-vscode/vsc-extension-quickstart.md/0
{ "file_path": "devchat-vscode/vsc-extension-quickstart.md", "repo_id": "devchat-vscode", "token_count": 712 }
21
from contextlib import AbstractContextManager class Step(AbstractContextManager): """ Show a running step in the TUI. ChatMark syntax: ```Step # Something is running... some details... ``` Usage: with Step("Something is running..."): print("some details...") """ ...
devchat/devchat/chatmark/step.py/0
{ "file_path": "devchat/devchat/chatmark/step.py", "repo_id": "devchat", "token_count": 233 }
22
from .chat import chat, chat_json from .openai import chat_completion_no_stream_return_json, chat_completion_stream from .text_confirm import llm_edit_confirm from .tools_call import chat_tools, llm_func, llm_param __all__ = [ "chat_completion_stream", "chat_completion_no_stream_return_json", "chat_json", ...
devchat/devchat/llm/__init__.py/0
{ "file_path": "devchat/devchat/llm/__init__.py", "repo_id": "devchat", "token_count": 167 }
23
# pylint: disable=import-outside-toplevel from dataclasses import asdict import json import os from typing import List, Dict, Any, Optional from tinydb import TinyDB, where, Query from tinydb.table import Table from devchat.chat import Chat from devchat.prompt import Prompt from devchat.utils import get_logger logger ...
devchat/devchat/store.py/0
{ "file_path": "devchat/devchat/store.py", "repo_id": "devchat", "token_count": 5877 }
24
# workflows DevChat workflows (the `sys` directory) ## Quick Start ```shell cd ~/.chat/workflows git clone https://github.com/devchat-ai/workflows.git sys ```
workflows/README.md/0
{ "file_path": "workflows/README.md", "repo_id": "workflows", "token_count": 55 }
25
description: Try to find out potential bugs in the selected code and try fixing these bugs automaticly. steps: - run: $devchat_python $command_path/main.py
workflows/fix/command.yml/0
{ "file_path": "workflows/fix/command.yml", "repo_id": "workflows", "token_count": 42 }
26
from .chat import chat, chat_json from .memory.base import ChatMemory from .memory.fixsize_memory import FixSizeChatMemory from .openai import chat_completion_no_stream_return_json, chat_completion_stream from .text_confirm import llm_edit_confirm from .tools_call import chat_tools, llm_func, llm_param __all__ = [ ...
workflows/libs/llm_api/__init__.py/0
{ "file_path": "workflows/libs/llm_api/__init__.py", "repo_id": "workflows", "token_count": 208 }
27
i18n-gen-msg: @echo "# Generating i18n base messages..." xgettext -k_i -o ./locales/base.pot --from-code=UTF-8 main.py @echo "# Done." i18n-init-langs: @echo "# Init i18n language templates." @echo "- Initializing zh template..." msginit -i ./locales/base.pot -o ./locales/zh/base.po -l zh @echo "- Initializing...
workflows/unit_tests/Makefile/0
{ "file_path": "workflows/unit_tests/Makefile", "repo_id": "workflows", "token_count": 375 }
28
description: "add tests" input: required steps: - run: $devchat_python $command_path/command.py "$input"
LabWorkflows/add_tests/command.yml/0
{ "file_path": "LabWorkflows/add_tests/command.yml", "repo_id": "LabWorkflows", "token_count": 35 }
0
# flake8: noqa: E402 import os import re import subprocess import sys home = os.path.expanduser("~") org_libs_path = os.path.join(home, ".chat", "workflows", "org", "libs") sys_libs_path = os.path.join(home, ".chat", "workflows", "sys", "libs") sys.path.append(org_libs_path) sys.path.append(sys_libs_path) sys.path.app...
LabWorkflows/git/commit/commit.py/0
{ "file_path": "LabWorkflows/git/commit/commit.py", "repo_id": "LabWorkflows", "token_count": 6117 }
1
description: "Improve naming conventions for functions, classes, files, etc." input: required steps: - run: $devchat_python $command_path/command.py "$input"
LabWorkflows/optimize_naming/command.yml/0
{ "file_path": "LabWorkflows/optimize_naming/command.yml", "repo_id": "LabWorkflows", "token_count": 43 }
2
description: Optimizing variable and function names in code. steps: - run: $devchat_python $command_path/../rewrite.py "Refine internal variable and function names within the code to achieve concise and meaningful identifiers that comply with English naming conventions."
LabWorkflows/rewrite/optimize_names/command.yml/0
{ "file_path": "LabWorkflows/rewrite/optimize_names/command.yml", "repo_id": "LabWorkflows", "token_count": 59 }
3
description: commands groups for workflow.
LabWorkflows/workflow/command.yml/0
{ "file_path": "LabWorkflows/workflow/command.yml", "repo_id": "LabWorkflows", "token_count": 7 }
4
<?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="VcsDirectoryMappings"> <mapping directory="" vcs="Git" /> <mapping directory="$PROJECT_DIR$/gui" vcs="Git" /> <mapping directory="$PROJECT_DIR$/tools" vcs="Git" /> <mapping directory="$PROJECT_DIR$/workflows" vcs="Git" /> ...
devchat-intellij/.idea/vcs.xml/0
{ "file_path": "devchat-intellij/.idea/vcs.xml", "repo_id": "devchat-intellij", "token_count": 135 }
5
@rem @rem Copyright 2015 the original author or authors. @rem @rem Licensed under the Apache License, Version 2.0 (the "License"); @rem you may not use this file except in compliance with the License. @rem You may obtain a copy of the License at @rem @rem https://www.apache.org/licenses/LICENSE-2.0 @rem @rem Unles...
devchat-intellij/gradlew.bat/0
{ "file_path": "devchat-intellij/gradlew.bat", "repo_id": "devchat-intellij", "token_count": 885 }
6
package ai.devchat.core.handlers import ai.devchat.core.BaseActionHandler import ai.devchat.core.DevChatActions import ai.devchat.plugin.currentProject import com.alibaba.fastjson.JSONObject import java.io.BufferedReader import java.io.File class AddContextRequestHandler(requestAction: String, metadata: JSONObject?, ...
devchat-intellij/src/main/kotlin/ai/devchat/core/handlers/AddContextRequestHandler.kt/0
{ "file_path": "devchat-intellij/src/main/kotlin/ai/devchat/core/handlers/AddContextRequestHandler.kt", "repo_id": "devchat-intellij", "token_count": 512 }
7
package ai.devchat.core.handlers import ai.devchat.core.BaseActionHandler import ai.devchat.core.DevChatActions import ai.devchat.plugin.currentProject import com.alibaba.fastjson.JSONObject import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.command.CommandProcessor import com.intel...
devchat-intellij/src/main/kotlin/ai/devchat/core/handlers/ReplaceFileContentHandler.kt/0
{ "file_path": "devchat-intellij/src/main/kotlin/ai/devchat/core/handlers/ReplaceFileContentHandler.kt", "repo_id": "devchat-intellij", "token_count": 423 }
8
package ai.devchat.plugin import ai.devchat.storage.DevChatState import ai.devchat.storage.ToolWindowState import ai.grazie.utils.applyIf import com.intellij.openapi.application.runInEdt import com.intellij.openapi.wm.ToolWindowManager import com.intellij.openapi.wm.ex.ToolWindowManagerListener class ToolWindowState...
devchat-intellij/src/main/kotlin/ai/devchat/plugin/ToolWindowStateListener.kt/0
{ "file_path": "devchat-intellij/src/main/kotlin/ai/devchat/plugin/ToolWindowStateListener.kt", "repo_id": "devchat-intellij", "token_count": 796 }
9
package ai.devchat.storage import ai.devchat.common.OSInfo import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.components.PersistentStateComponent import com.intellij.openapi.components.State import com.intellij.openapi.components.Storage import com.intellij.util.xmlb.XmlSerializerUt...
devchat-intellij/src/main/kotlin/ai/devchat/storage/DevChatSettingsState.kt/0
{ "file_path": "devchat-intellij/src/main/kotlin/ai/devchat/storage/DevChatSettingsState.kt", "repo_id": "devchat-intellij", "token_count": 519 }
10
import * as path from 'path'; import { ChatContext } from './contextManager'; import { createTempSubdirectory, runCommandStringAndWriteOutput } from '../util/commonUtil'; import { logger } from '../util/logger'; export const gitDiffContext: ChatContext = { name: 'git diff HEAD', description: 'all changes since t...
devchat-vscode/src/context/contextGitDiff.ts/0
{ "file_path": "devchat-vscode/src/context/contextGitDiff.ts", "repo_id": "devchat-vscode", "token_count": 274 }
11
// 代码分为多个block, 每个block包含一个变量集合 export interface BlockInfo { file: string; startLine: number; endLine: number; lastTime: number; identifiers: string[]; } // 每个代码文件包含多个block export interface FileBlockInfo { path: string; lastTime: number; blocks: BlockInfo[]; hashKey: string; }
devchat-vscode/src/contributes/codecomplete/astIndex/types.ts/0
{ "file_path": "devchat-vscode/src/contributes/codecomplete/astIndex/types.ts", "repo_id": "devchat-vscode", "token_count": 160 }
12