text
stringlengths
7
1.68M
id
stringlengths
17
99
metadata
dict
__index_level_0__
int64
0
33
#!/bin/bash # 获取脚本所在目录 SCRIPT_DIR=$(dirname "$0") TEST_DIR="${SCRIPT_DIR}" REQUIREMENTS_FILE="${TEST_DIR}/requirements-test.txt" CONFIG_FILE="${TEST_DIR}/commit_message_prompt_config.yaml" # 安装Node.js依赖 echo "Installing promptfoo using npx..." npx promptfoo@latest # 检查Python是否安装 if ! command -v python3 &> /dev/null ...
workflows/commit/test/prompt/run.sh/0
{ "file_path": "workflows/commit/test/prompt/run.sh", "repo_id": "workflows", "token_count": 321 }
28
from .form import Form from .step import Step from .widgets import Button, Checkbox, Radio, TextEditor __all__ = [ "Checkbox", "TextEditor", "Radio", "Button", "Form", "Step", ]
workflows/libs/chatmark/__init__.py/0
{ "file_path": "workflows/libs/chatmark/__init__.py", "repo_id": "workflows", "token_count": 80 }
29
from .base import ChatMemory class FixSizeChatMemory(ChatMemory): """ FixSizeChatMemory is a memory class that stores up to a fixed number of requests and responses. """ def __init__(self, max_size: int = 5, messages=[], system_prompt=None): """ init the memory """ ...
workflows/libs/llm_api/memory/fixsize_memory.py/0
{ "file_path": "workflows/libs/llm_api/memory/fixsize_memory.py", "repo_id": "workflows", "token_count": 661 }
30
import os import sys from typing import Dict, List, Tuple import click sys.path.append(os.path.dirname(__file__)) sys.path.append(os.path.join(os.path.dirname(__file__), "..", "libs")) from cache import LocalCache from chatmark import Checkbox, Form, Step, TextEditor # noqa: E402 from find_context import ( Cont...
workflows/unit_tests/main.py/0
{ "file_path": "workflows/unit_tests/main.py", "repo_id": "workflows", "token_count": 5446 }
31
import sys import os import interpreter import builtins sys.path.append(os.path.join(os.path.dirname(__file__), "..", "..", "sys", "libs")) sys.path.append(os.path.dirname(__file__)) from chatmark import TextEditor buildin_input = builtins.input has_input = False def ui_text_edit(title, text): print(title, e...
LabWorkflows/code_interpreter/command.py/0
{ "file_path": "LabWorkflows/code_interpreter/command.py", "repo_id": "LabWorkflows", "token_count": 355 }
0
import requests import yaml import sys import os sys.path.append(os.path.join(os.path.dirname(__file__), "..", "..", "..", "libs")) from llm_api import chat_completion_stream # noqa: E402 # 请替换为您的GitHub个人访问令牌 GITHUB_TOKEN = "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" # 设置GitHub API请求头 headers = { "Authorizati...
LabWorkflows/git/commit/test/prompt/gen_cases.py/0
{ "file_path": "LabWorkflows/git/commit/test/prompt/gen_cases.py", "repo_id": "LabWorkflows", "token_count": 1968 }
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/from_task/command.py/0
{ "file_path": "LabWorkflows/git/new_issue/from_task/command.py", "repo_id": "LabWorkflows", "token_count": 1219 }
2
description: "review pr" input: required steps: - run: $command_python $command_path/../command.py "$input" describe
LabWorkflows/pr/describe/command.yml/0
{ "file_path": "LabWorkflows/pr/describe/command.yml", "repo_id": "LabWorkflows", "token_count": 35 }
3
description: install workflows. input: optional steps: - run: $devchat_python $command_path/command.py
LabWorkflows/workflow/install/command.yml/0
{ "file_path": "LabWorkflows/workflow/install/command.yml", "repo_id": "LabWorkflows", "token_count": 31 }
4
import os import sys import hashlib import json sys.path.append(os.path.join(os.path.expanduser('~'), '.chat', 'workflows', 'org', 'libs')) sys.path.append(os.path.join(os.path.expanduser('~'), '.chat', 'workflows', 'sys', 'libs')) from ide_services import IDEService def get_file_hash(filename, hash_algorithm='sha2...
LabWorkflows/workflow/reinstalldeps/python_update.py/0
{ "file_path": "LabWorkflows/workflow/reinstalldeps/python_update.py", "repo_id": "LabWorkflows", "token_count": 1652 }
5
## Commit ### JS to Java ```json { "action": "commitCode/request", "metadata": { "callback": "responseFunctionName" }, "payload": { "message": "Commit message" } } ``` ### Java to JS - success ```json { "action": "commitCode/response", "metadata": { "status": "success", "error": "" ...
devchat-intellij/api/commit.md/0
{ "file_path": "devchat-intellij/api/commit.md", "repo_id": "devchat-intellij", "token_count": 209 }
6
package ai.devchat.common import java.util.* object OSInfo { val OS_NAME: String = System.getProperty("os.name").lowercase(Locale.getDefault()) val OS_ARCH: String = System.getProperty("os.arch") val isWindows: Boolean = OS_NAME.contains("win") val platform: String = when { OS_NAME.contains(...
devchat-intellij/src/main/kotlin/ai/devchat/common/OSInfo.kt/0
{ "file_path": "devchat-intellij/src/main/kotlin/ai/devchat/common/OSInfo.kt", "repo_id": "devchat-intellij", "token_count": 504 }
7
package ai.devchat.core.handlers import ai.devchat.core.DevChatWrapper import ai.devchat.core.BaseActionHandler import ai.devchat.core.DevChatActions import com.alibaba.fastjson.JSONObject import kotlinx.coroutines.runBlocking class InputRequestHandler(requestAction: String, metadata: JSONObject?, payload: JSONObject...
devchat-intellij/src/main/kotlin/ai/devchat/core/handlers/InputRequestHandler.kt/0
{ "file_path": "devchat-intellij/src/main/kotlin/ai/devchat/core/handlers/InputRequestHandler.kt", "repo_id": "devchat-intellij", "token_count": 230 }
8
package ai.devchat.core.handlers import ai.devchat.core.BaseActionHandler import ai.devchat.core.DevChatActions import ai.devchat.storage.CONFIG import com.alibaba.fastjson.JSONObject class UpdateLanguageRequestHandler(requestAction: String, metadata: JSONObject?, payload: JSONObject?) : BaseActionHandler( reques...
devchat-intellij/src/main/kotlin/ai/devchat/core/handlers/UpdateLanguageRequestHandler.kt/0
{ "file_path": "devchat-intellij/src/main/kotlin/ai/devchat/core/handlers/UpdateLanguageRequestHandler.kt", "repo_id": "devchat-intellij", "token_count": 271 }
9
status.ts: 代码补全状态表达接口。预期有三种状态:未就绪、就绪、代码补全中。
devchat-vscode/src/contributes/codecomplete/README.md/0
{ "file_path": "devchat-vscode/src/contributes/codecomplete/README.md", "repo_id": "devchat-vscode", "token_count": 74 }
10
/* 写一个类,在这个类中监控项目文件是否发生变化,每次变化后,重新执行git diff命令,获取变化的文件列表,并将变化的文件列表返回给调用者。 */ import * as fs from 'fs'; import * as path from 'path'; import * as vscode from 'vscode'; import { exec } from 'child_process'; import { UiUtilWrapper } from '../../util/uiUtil'; import { logger } from '../../util/logger'; import { collap...
devchat-vscode/src/contributes/codecomplete/gitDiffWatcher.ts/0
{ "file_path": "devchat-vscode/src/contributes/codecomplete/gitDiffWatcher.ts", "repo_id": "devchat-vscode", "token_count": 3304 }
11
import * as vscode from "vscode"; import { collapseFileExculdeSelectRange } from "./codecomplete/ast/collapseBlock"; class DevChatQuickFixProvider implements vscode.CodeActionProvider { public static readonly providedCodeActionKinds = [ vscode.CodeActionKind.QuickFix, ]; provideCodeActions( ...
devchat-vscode/src/contributes/quickFixProvider.ts/0
{ "file_path": "devchat-vscode/src/contributes/quickFixProvider.ts", "repo_id": "devchat-vscode", "token_count": 898 }
12
import * as vscode from 'vscode'; import { MessageHandler } from './messageHandler'; import { regInMessage, regOutMessage } from '../util/reg_messages'; import { historyMessagesBase, LoadHistoryMessages, loadTopicHistoryFromCurrentMessageHistory } from './historyMessagesBase'; import { UiUtilWrapper } from '../util/uiU...
devchat-vscode/src/handler/historyMessagesHandler.ts/0
{ "file_path": "devchat-vscode/src/handler/historyMessagesHandler.ts", "repo_id": "devchat-vscode", "token_count": 408 }
13
import { logger } from "../../util/logger"; export async function ideLogging(level: string, message: string) { if (typeof logger.channel()?.[level] === "function") { // level is one of "info", "warn", "error", "debug" logger.channel()?.[level](message); return true; } return false; ...
devchat-vscode/src/ide_services/endpoints/ideLogging.ts/0
{ "file_path": "devchat-vscode/src/ide_services/endpoints/ideLogging.ts", "repo_id": "devchat-vscode", "token_count": 121 }
14
import { logger } from "../util/logger"; import { CommandRun } from "../util/commonUtil"; import { UiUtilWrapper } from "../util/uiUtil"; interface DtmResponse { status: number; message: string; log: string; } class DtmWrapper { private workspaceDir: string; private commandRun: CommandRun; constructor() { t...
devchat-vscode/src/toolwrapper/dtm.ts/0
{ "file_path": "devchat-vscode/src/toolwrapper/dtm.ts", "repo_id": "devchat-vscode", "token_count": 535 }
15
/* Install devchat */ import { logger } from "../logger"; import { installConda } from "./conda_install"; import { getMicromambaUrl } from "./conda_url"; import { installPackage } from "./package_install"; import { installPython, installPythonMicromamba } from "./python_install"; // step 1. install conda // step 2....
devchat-vscode/src/util/python_installer/app_install.ts/0
{ "file_path": "devchat-vscode/src/util/python_installer/app_install.ts", "repo_id": "devchat-vscode", "token_count": 1151 }
16
import { expect } from 'chai'; // import { describe, it } from 'mocha'; import sinon from 'sinon'; import * as path from 'path'; import { parseMessage, parseMessageAndSetOptions, processChatResponse, sendMessageBase, stopDevChatBase } from '../../src/handler/sendMessageBase'; import { ChatResponse } from '../../src/too...
devchat-vscode/test/handler/sendMessageBase.test.ts/0
{ "file_path": "devchat-vscode/test/handler/sendMessageBase.test.ts", "repo_id": "devchat-vscode", "token_count": 2354 }
17
{ "name": "git log for release note", "description": "formatted commit history since the specified commit", "edit": true, "command": ["git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:\"%h - %B\""] }
devchat-vscode/workflows/default/context/git_log_for_releasenote/_setting_.json/0
{ "file_path": "devchat-vscode/workflows/default/context/git_log_for_releasenote/_setting_.json", "repo_id": "devchat-vscode", "token_count": 72 }
18
# pylint: disable=import-outside-toplevel from typing import List, Optional, Tuple from .command import command, Command @command('run', help="The 'command' argument is the name of the command to run or get information about.") @Command.argument('command', nargs='?', default='') @Command.option('--list', dest='l...
devchat/devchat/_cli/run.py/0
{ "file_path": "devchat/devchat/_cli/run.py", "repo_id": "devchat", "token_count": 2968 }
19
import os import sys from typing import List, Dict, Tuple, Optional from pydantic import BaseModel import oyaml as yaml class GeneralProviderConfig(BaseModel): api_key: Optional[str] api_base: Optional[str] class ModelConfig(BaseModel): max_input_tokens: Optional[int] = sys.maxsize provider: Optional...
devchat/devchat/config.py/0
{ "file_path": "devchat/devchat/config.py", "repo_id": "devchat", "token_count": 2188 }
20
# flake8: noqa: E402 import json import os import re from typing import Dict, List import openai from .pipeline import ( RetryException, exception_handle, exception_output_handle, parallel, pipeline, retry, ) def _try_remove_markdown_block_flag(content): """ 如果content是一个markdown块,则删除...
devchat/devchat/llm/openai.py/0
{ "file_path": "devchat/devchat/llm/openai.py", "repo_id": "devchat", "token_count": 2559 }
21
# pylint: disable=import-outside-toplevel import logging import os import re import getpass import socket import subprocess from typing import List, Tuple, Optional import datetime import hashlib log_formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') # pylint: disable=invalid-name e...
devchat/devchat/utils.py/0
{ "file_path": "devchat/devchat/utils.py", "repo_id": "devchat", "token_count": 3366 }
22
import os import json import pytest from click.testing import CliRunner from devchat.config import ConfigManager, GeneralModelConfig from devchat._cli.click_main import click_main from devchat.utils import openai_response_tokens from devchat.utils import check_format, get_content, get_prompt_hash runner = CliRunner() ...
devchat/tests/test_cli_prompt.py/0
{ "file_path": "devchat/tests/test_cli_prompt.py", "repo_id": "devchat", "token_count": 3874 }
23
description: Ask questions about the current project's codebase, which requires proactive acquisition of additional context information to answer. input: required steps: - run: $command_python $command_path/ask-code.py query "$input"
workflows/ask-code/command.yml/0
{ "file_path": "workflows/ask-code/command.yml", "repo_id": "workflows", "token_count": 53 }
24
## Overview This README provides information about the workflow used for generating commit messages based on commit differences. The workflow involves recording prompts, defining test cases, and running scripts to process these cases. ## Dependency Installation Before you can run the tests for commit message genera...
workflows/commit/test/prompt/readme.md/0
{ "file_path": "workflows/commit/test/prompt/readme.md", "repo_id": "workflows", "token_count": 894 }
25
description: "Send 'hello' to LLM and output response" input: required steps: - run: $devchat_python $command_path/command.py "$input"
LabWorkflows/chat/command.yml/0
{ "file_path": "LabWorkflows/chat/command.yml", "repo_id": "LabWorkflows", "token_count": 42 }
0
- vars: commit_message: The commit fixes a use-after-free error in the AFS volume tree due to a race condition between volume lookup and removal. The patch prevents looking up volumes with zero reference count and ensures that once a volume's refcount reaches zero, it is flagged and not looked up ...
LabWorkflows/git/commit/test/prompt/commit_message_tests.yaml/0
{ "file_path": "LabWorkflows/git/commit/test/prompt/commit_message_tests.yaml", "repo_id": "LabWorkflows", "token_count": 2829 }
1
description: 'Create new issue.' input: required steps: - run: $devchat_python $command_path/command.py "$input"
LabWorkflows/git/new_issue/command.yml/0
{ "file_path": "LabWorkflows/git/new_issue/command.yml", "repo_id": "LabWorkflows", "token_count": 35 }
2
description: 'Config LLM Module' input: optional steps: - run: $command_python $command_path/command.py
LabWorkflows/llm/config/command.yml/0
{ "file_path": "LabWorkflows/llm/config/command.yml", "repo_id": "LabWorkflows", "token_count": 32 }
3
description: schedule your tasks. hint: question input: required steps: - run: $devchat_python $command_path/command.py "$input" "ask"
LabWorkflows/task/command.yml/0
{ "file_path": "LabWorkflows/task/command.yml", "repo_id": "LabWorkflows", "token_count": 42 }
4
""" /workflow.install text -> step1: 列出所有的commands -> step2: 安装选择的commands -> step2.1: 下载选择的commands -> step2.2: 执行local_command_install """ import os import sys import requests import zipfile sys.path.append(os.path.join(os.path.expanduser('~'), '.chat', 'workflows', 'org', 'libs')) sys.path.append(os.path.join(os...
LabWorkflows/workflow/install/command.py/0
{ "file_path": "LabWorkflows/workflow/install/command.py", "repo_id": "LabWorkflows", "token_count": 1408 }
5
description: reinstall dependencies from the updated requirements.txt for a specified command. input: optional steps: - run: $devchat_python $command_path/command.py
LabWorkflows/workflow/reinstalldeps/command.yml/0
{ "file_path": "LabWorkflows/workflow/reinstalldeps/command.yml", "repo_id": "LabWorkflows", "token_count": 41 }
6
## Query Command List ### JS to Java ```json { "action": "listCommands/request", "metadata": { "callback": "responseFunctionName" }, "payload": null } ``` ### Java to JS ```json { "action": "listCommands/response", "metadata": { "status": "success", "error": "" }, "payload": { "comma...
devchat-intellij/api/command.md/0
{ "file_path": "devchat-intellij/api/command.md", "repo_id": "devchat-intellij", "token_count": 249 }
7
package ai.devchat.common import com.intellij.notification.NotificationType import com.intellij.notification.Notification import com.intellij.notification.Notifications object Notifier { fun error(content: String) { val notification = Notification( "Custom Notification Group", "DevChat", conte...
devchat-intellij/src/main/kotlin/ai/devchat/common/Notifier.kt/0
{ "file_path": "devchat-intellij/src/main/kotlin/ai/devchat/common/Notifier.kt", "repo_id": "devchat-intellij", "token_count": 317 }
8
package ai.devchat.core.handlers import ai.devchat.core.BaseActionHandler import ai.devchat.core.DevChatActions import ai.devchat.storage.CONFIG import com.alibaba.fastjson.JSONObject class GetSettingRequestHandler(requestAction: String, metadata: JSONObject?, payload: JSONObject?) : BaseActionHandler( requestA...
devchat-intellij/src/main/kotlin/ai/devchat/core/handlers/GetSettingRequestHandler.kt/0
{ "file_path": "devchat-intellij/src/main/kotlin/ai/devchat/core/handlers/GetSettingRequestHandler.kt", "repo_id": "devchat-intellij", "token_count": 194 }
9
package ai.devchat.core.handlers import ai.devchat.core.DevChatWrapper import ai.devchat.core.BaseActionHandler import ai.devchat.core.DevChatActions import com.alibaba.fastjson.JSONObject class StopGenerationRequestHandler(requestAction: String, metadata: JSONObject?, payload: JSONObject?) : BaseActionHandler( r...
devchat-intellij/src/main/kotlin/ai/devchat/core/handlers/StopGenerationRequestHandler.kt/0
{ "file_path": "devchat-intellij/src/main/kotlin/ai/devchat/core/handlers/StopGenerationRequestHandler.kt", "repo_id": "devchat-intellij", "token_count": 188 }
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/ExplainCode.kt/0
{ "file_path": "devchat-intellij/src/main/kotlin/ai/devchat/plugin/actions/ExplainCode.kt", "repo_id": "devchat-intellij", "token_count": 621 }
11
import { ChatContextManager } from './contextManager'; import { gitDiffCachedContext } from './contextGitDiffCached'; import { gitDiffContext } from './contextGitDiff'; import { customCommandContext } from './contextCustomCommand'; // import { refDefsContext } from './contextRefDefs'; // import { defRefsContext } from ...
devchat-vscode/src/context/loadContexts.ts/0
{ "file_path": "devchat-vscode/src/context/loadContexts.ts", "repo_id": "devchat-vscode", "token_count": 187 }
12
export class Debouncer { private debouncing = false; private debounceTimeout?: NodeJS.Timeout; private lastTimeStampt?: string; constructor(private debounceDelay: number) { } async debounce(): Promise<boolean> { const timestampt = Date.now().toString(); this.lastTimeStampt = timest...
devchat-vscode/src/contributes/codecomplete/debouncer.ts/0
{ "file_path": "devchat-vscode/src/contributes/codecomplete/debouncer.ts", "repo_id": "devchat-vscode", "token_count": 468 }
13
import * as vscode from 'vscode'; export function regLanguageContext() { const currentLocale = vscode.env.language; if (currentLocale === 'zh-cn' || currentLocale === 'zh-tw') { vscode.commands.executeCommand('setContext', 'isChineseLocale', true); } else { vscode.commands.executeCommand('setContext', 'isChines...
devchat-vscode/src/contributes/context.ts/0
{ "file_path": "devchat-vscode/src/contributes/context.ts", "repo_id": "devchat-vscode", "token_count": 118 }
14
import DevChat, { LogEntry, LogOptions } from '../toolwrapper/devchat'; import messageHistory from '../util/messageHistory'; import { ApiKeyManager } from '../util/apiKey'; export interface LoadHistoryMessages { command: string; entries: Array<LogEntry>; } function welcomeMessage(): LogEntry { // create default...
devchat-vscode/src/handler/historyMessagesBase.ts/0
{ "file_path": "devchat-vscode/src/handler/historyMessagesBase.ts", "repo_id": "devchat-vscode", "token_count": 1297 }
15
import { DevChatConfig } from "../../util/config"; export async function ideLanguage() { const language = DevChatConfig.getInstance().get('language'); // 'en' stands for English, 'zh' stands for Simplified Chinese return language; }
devchat-vscode/src/ide_services/endpoints/ideLanguage.ts/0
{ "file_path": "devchat-vscode/src/ide_services/endpoints/ideLanguage.ts", "repo_id": "devchat-vscode", "token_count": 71 }
16
import * as dotenv from 'dotenv'; import * as path from 'path'; import * as fs from 'fs'; import * as os from 'os'; import { logger } from '../util/logger'; import { CommandRun } from "../util/commonUtil"; import { UiUtilWrapper } from '../util/uiUtil'; import { ApiKeyManager } from '../util/apiKey'; import { assertVa...
devchat-vscode/src/toolwrapper/devchat.ts/0
{ "file_path": "devchat-vscode/src/toolwrapper/devchat.ts", "repo_id": "devchat-vscode", "token_count": 6476 }
17
import * as vscode from 'vscode'; export class ProgressBar { private message: string; private error: string | undefined; private finish: boolean | undefined; constructor() { this.message = ""; } init() { vscode.window.withProgress({ location: vscode.ProgressLocation.Not...
devchat-vscode/src/util/progressBar.ts/0
{ "file_path": "devchat-vscode/src/util/progressBar.ts", "repo_id": "devchat-vscode", "token_count": 567 }
18
import { expect } from 'chai'; import sinon from 'sinon'; import vscodeMock from '../mocks/vscode'; import * as proxyquire from 'proxyquire'; const proxy = proxyquire.noCallThru(); // 使用 proxyquire 加载业务代码,并替换 'vscode' 模块 const { createAndOpenFile } = proxy('../../src/handler/codeBlockHandler', { 'vscode': vscodeMock ...
devchat-vscode/test/handler/codeBlockHandler.test.ts/0
{ "file_path": "devchat-vscode/test/handler/codeBlockHandler.test.ts", "repo_id": "devchat-vscode", "token_count": 1971 }
19
//@ts-check "use strict"; const path = require("path"); //@ts-check /** @typedef {import('webpack').Configuration} WebpackConfig **/ /** @type WebpackConfig */ const extensionConfig = { name: "vscode extension", target: "node", // VS Code extensions run in a Node.js-context 📖 -> https://webpack.js.org/configur...
devchat-vscode/webpack.config.js/0
{ "file_path": "devchat-vscode/webpack.config.js", "repo_id": "devchat-vscode", "token_count": 783 }
20
# pylint: disable=import-outside-toplevel import json import sys from typing import List, Optional def _get_model_and_config( model: Optional[str], config_str: Optional[str]): from devchat._cli.utils import init_dir, get_model_config _1, user_chat_dir = init_dir() model, config = get_mode...
devchat/devchat/_cli/router.py/0
{ "file_path": "devchat/devchat/_cli/router.py", "repo_id": "devchat", "token_count": 2187 }
21
from abc import ABC, abstractmethod from typing import Dict, List, Optional, Tuple from uuid import uuid4 from .iobase import pipe_interaction class Widget(ABC): """ Abstract base class for widgets """ def __init__(self, submit: Optional[str] = None, cancel: Optional[str] = None): self._rend...
devchat/devchat/chatmark/widgets.py/0
{ "file_path": "devchat/devchat/chatmark/widgets.py", "repo_id": "devchat", "token_count": 4514 }
22
import json import os import sys from functools import wraps import openai from devchat.memory import ChatMemory from .openai import ( chat_completion_no_stream_return_json, chat_completion_stream, chat_completion_stream_commit, chunks_content, retry_timeout, stream_out_chunk, to_dict_con...
devchat/devchat/llm/chat.py/0
{ "file_path": "devchat/devchat/llm/chat.py", "repo_id": "devchat", "token_count": 1624 }
23
IQ== 0 Ig== 1 Iw== 2 JA== 3 JQ== 4 Jg== 5 Jw== 6 KA== 7 KQ== 8 Kg== 9 Kw== 10 LA== 11 LQ== 12 Lg== 13 Lw== 14 MA== 15 MQ== 16 Mg== 17 Mw== 18 NA== 19 NQ== 20 Ng== 21 Nw== 22 OA== 23 OQ== 24 Og== 25 Ow== 26 PA== 27 PQ== 28 Pg== 29 Pw== 30 QA== 31 QQ== 32 Qg== 33 Qw== 34 RA== 35 RQ== 36 Rg== 37 Rw== 38 SA== 39 SQ== 40 Sg...
devchat/devchat/tiktoken_cache/9b5ad71b2ce5302211f9c61530b329a4922fc6a4/0
{ "file_path": "devchat/devchat/tiktoken_cache/9b5ad71b2ce5302211f9c61530b329a4922fc6a4", "repo_id": "devchat", "token_count": 1083811 }
24
import json from click.testing import CliRunner from devchat.utils import get_prompt_hash, get_content from devchat._cli.click_main import click_main runner = CliRunner() def test_log_no_args(git_repo): # pylint: disable=W0613 result = runner.invoke(click_main, ['log']) assert result.exit_code == 0 logs...
devchat/tests/test_cli_log.py/0
{ "file_path": "devchat/tests/test_cli_log.py", "repo_id": "devchat", "token_count": 2722 }
25
import os import sys from chat.ask_codebase.chains.smart_qa import SmartQA sys.path.append(os.path.join(os.path.dirname(__file__), "..", "libs")) sys.path.append(os.path.join(os.path.dirname(__file__), "..", "..", "libs")) from ide_services import IDEService # noqa: E402 def query(question, lsp_brige_port): r...
workflows/ask-code/ask-code.py/0
{ "file_path": "workflows/ask-code/ask-code.py", "repo_id": "workflows", "token_count": 1096 }
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/fix/main.py/0
{ "file_path": "workflows/fix/main.py", "repo_id": "workflows", "token_count": 1818 }
27
### 操作指南 生成单元测试,请按照如下步骤操作: 1. 点击函数头部的**DevChat: unit tests**按钮。 2. 选择Happy Path和Edge Case测试用例。 3. (可选)输入控制信息:补充测试用例、参考文件和附加提示词。 4. 点击提交按钮,等待生成结束。 如图所示: ![图片](https://deploy-script.merico.cn/devchat/workflow/readme_unit_tests.gif)
workflows/unit_tests/README.md/0
{ "file_path": "workflows/unit_tests/README.md", "repo_id": "workflows", "token_count": 260 }
28
# English translations for PACKAGE package. # Copyright (C) 2023 THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # kagami <mingjing@merico.dev>, 2023. # msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024...
workflows/unit_tests/locales/en/base.po/0
{ "file_path": "workflows/unit_tests/locales/en/base.po", "repo_id": "workflows", "token_count": 712 }
29
import subprocess import sys import time import requests import json import os 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) ...
LabWorkflows/foundation_demo/command.py/0
{ "file_path": "LabWorkflows/foundation_demo/command.py", "repo_id": "LabWorkflows", "token_count": 472 }
0
description: "demo for chat with memory" steps: - run: $devchat_python $command_path/command.py
LabWorkflows/llm_demo/chat_with_memory/command.yml/0
{ "file_path": "LabWorkflows/llm_demo/chat_with_memory/command.yml", "repo_id": "LabWorkflows", "token_count": 31 }
1
description: get the current weather in a given location hint: in $location in degrees $unit parameters: location: type: string description: The city and state, e.g. San Francisco, CA unit: type: string enum: [celsius, fahrenheit] default: celsius steps: - run: $command_python $command_path/w...
LabWorkflows/weather/command.yml/0
{ "file_path": "LabWorkflows/weather/command.yml", "repo_id": "LabWorkflows", "token_count": 119 }
2
""" 当前脚本用于实现 /workflow.new命令 具体步骤有: -> step1: 选择command类型 -> step2: 创建目录结构 -> step3: 使用vscode打开新目录 -> step4: run hello world command """ import os import sys sys.path.append(os.path.join(os.path.expanduser('~'), '.chat', 'workflows', 'org', 'libs')) sys.path.append(os.path.join(os.path.expanduser('~'), '.chat', 'work...
LabWorkflows/workflow/new/command.py/0
{ "file_path": "LabWorkflows/workflow/new/command.py", "repo_id": "LabWorkflows", "token_count": 2467 }
3
<?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="GradleMigrationSettings" migrationVersion="1" /> <component name="GradleSettings"> <option name="linkedExternalProjectsSettings"> <GradleProjectSettings> <option name="externalProjectPath" value="$PROJECT_DIR$" /> ...
devchat-intellij/.idea/gradle.xml/0
{ "file_path": "devchat-intellij/.idea/gradle.xml", "repo_id": "devchat-intellij", "token_count": 231 }
4
plugins { id("java") id("org.jetbrains.intellij") version "1.17.3" id("org.jetbrains.changelog") version "2.2.0" kotlin("jvm") version "1.9.23" kotlin("plugin.serialization") version "1.9.23" } group = "ai.devchat" version = "0.2.6" repositories { mavenCentral() } dependencies { implement...
devchat-intellij/build.gradle.kts/0
{ "file_path": "devchat-intellij/build.gradle.kts", "repo_id": "devchat-intellij", "token_count": 1306 }
5
package ai.devchat.core object DevChatActions { const val SEND_MESSAGE_REQUEST = "sendMessage/request" const val SEND_MESSAGE_RESPONSE = "sendMessage/response" const val REGENERATION_REQUEST = "regeneration/request" const val SEND_USER_MESSAGE_REQUEST = "sendUserMessage/request" const val SEND_USER...
devchat-intellij/src/main/kotlin/ai/devchat/core/DevChatActions.kt/0
{ "file_path": "devchat-intellij/src/main/kotlin/ai/devchat/core/DevChatActions.kt", "repo_id": "devchat-intellij", "token_count": 1199 }
6
package ai.devchat.core.handlers import ai.devchat.core.BaseActionHandler import ai.devchat.core.DevChatActions import ai.devchat.storage.ActiveConversation import com.alibaba.fastjson.JSONObject class LoadConversationRequestHandler(requestAction: String, metadata: JSONObject?, payload: JSONObject?) : BaseActionHandl...
devchat-intellij/src/main/kotlin/ai/devchat/core/handlers/LoadConversationRequestHandler.kt/0
{ "file_path": "devchat-intellij/src/main/kotlin/ai/devchat/core/handlers/LoadConversationRequestHandler.kt", "repo_id": "devchat-intellij", "token_count": 569 }
7
package ai.devchat.plugin import ai.devchat.core.DevChatWrapper import ai.devchat.common.Log import ai.devchat.installer.DevChatSetupThread import com.intellij.openapi.Disposable import com.intellij.openapi.project.* import com.intellij.openapi.util.Disposer import com.intellij.openapi.wm.ToolWindow import com.intelli...
devchat-intellij/src/main/kotlin/ai/devchat/plugin/DevChatToolWindow.kt/0
{ "file_path": "devchat-intellij/src/main/kotlin/ai/devchat/plugin/DevChatToolWindow.kt", "repo_id": "devchat-intellij", "token_count": 616 }
8
package ai.devchat.plugin.hints import ai.devchat.common.DevChatBundle import ai.devchat.storage.CONFIG import com.alibaba.fastjson.JSONObject import com.intellij.openapi.editor.Editor import com.intellij.openapi.fileEditor.FileDocumentManager import com.intellij.psi.* import com.intellij.refactoring.suggested.endOffs...
devchat-intellij/src/main/kotlin/ai/devchat/plugin/hints/UnitTestsCVProvider.kt/0
{ "file_path": "devchat-intellij/src/main/kotlin/ai/devchat/plugin/hints/UnitTestsCVProvider.kt", "repo_id": "devchat-intellij", "token_count": 776 }
9
.vscode/** .vscode-test/** out/** node_modules/** src/** .gitignore .yarnrc webpack.config.js vsc-extension-quickstart.md **/tsconfig.json **/.eslintrc.json **/*.map **/*.ts gui/** test/**
devchat-vscode/.vscodeignore/0
{ "file_path": "devchat-vscode/.vscodeignore", "repo_id": "devchat-vscode", "token_count": 83 }
10
import * as path from 'path'; import { createTempSubdirectory, getLanguageIdByFileName } from '../util/commonUtil'; import { UiUtilWrapper } from '../util/uiUtil'; export async function handleCodeSelected(fileSelected: string, codeSelected: string, startLine: number) { // get file name from fileSelected const...
devchat-vscode/src/context/contextCodeSelected.ts/0
{ "file_path": "devchat-vscode/src/context/contextCodeSelected.ts", "repo_id": "devchat-vscode", "token_count": 364 }
11
/* This file is copied from Continut repo. */ import { logger } from "../../../util/logger"; import { UiUtilWrapper } from "../../../util/uiUtil"; import * as path from "path"; import * as fs from "fs"; import { Language } from "web-tree-sitter"; import Parser = require("web-tree-sitter"); import { getLanguageFullNa...
devchat-vscode/src/contributes/codecomplete/ast/treeSitter.ts/0
{ "file_path": "devchat-vscode/src/contributes/codecomplete/ast/treeSitter.ts", "repo_id": "devchat-vscode", "token_count": 1688 }
12
/* 针对代码补全功能,构建prompt prompt的好坏,取决于提供的上下文信息。 通过AST获取相对完整的信息,可能会增加提示的准确度,但也会增加代码提示的复杂度。 */ import * as fs from 'fs/promises'; import * as fsF from 'fs'; import * as path from 'path'; import { logger } from "../../util/logger"; import { getAst, getAstNodeByRange, getTreePathAtCursor, RangeInFileWithContents } from "...
devchat-vscode/src/contributes/codecomplete/promptCreator.ts/0
{ "file_path": "devchat-vscode/src/contributes/codecomplete/promptCreator.ts", "repo_id": "devchat-vscode", "token_count": 11457 }
13
import * as vscode from 'vscode'; import DtmWrapper from '../toolwrapper/dtm'; import { regInMessage, regOutMessage } from '../util/reg_messages'; import { runCommandAndWriteOutput } from '../util/commonUtil'; regInMessage({command: 'doCommit', content: ''}); export async function doCommit(message: any, panel: vscode....
devchat-vscode/src/handler/commitHandler.ts/0
{ "file_path": "devchat-vscode/src/handler/commitHandler.ts", "repo_id": "devchat-vscode", "token_count": 314 }
14
import * as vscode from 'vscode'; import * as os from 'os'; import * as path from 'path'; import * as fs from 'fs'; import { regInMessage, regOutMessage } from '../util/reg_messages'; import { MessageHandler } from './messageHandler'; import DevChat, { TopicEntry } from '../toolwrapper/devchat'; import { UiUtilWrapper ...
devchat-vscode/src/handler/topicHandler.ts/0
{ "file_path": "devchat-vscode/src/handler/topicHandler.ts", "repo_id": "devchat-vscode", "token_count": 885 }
15
import * as vscode from 'vscode'; export async function updateSlashCommands() { vscode.commands.executeCommand('DevChat.InstallCommands'); return true; }
devchat-vscode/src/ide_services/endpoints/updateSlashCommands.ts/0
{ "file_path": "devchat-vscode/src/ide_services/endpoints/updateSlashCommands.ts", "repo_id": "devchat-vscode", "token_count": 54 }
16
/* eslint-disable @typescript-eslint/naming-convention */ import * as fs from 'fs'; import * as os from 'os'; import * as path from 'path'; import * as yaml from 'yaml'; import * as util from 'util'; import * as childProcess from 'child_process'; import { parseArgsStringToArgv } from 'string-argv'; import { logger } ...
devchat-vscode/src/util/commonUtil.ts/0
{ "file_path": "devchat-vscode/src/util/commonUtil.ts", "repo_id": "devchat-vscode", "token_count": 3366 }
17
import { execSync } from 'child_process'; export function getPackageVersion(pythonPath: string, packageName: string): string | undefined { try { const stdout = execSync(`${pythonPath} -m pip show ${packageName}`).toString(); const versionLine = stdout.split('\n').find(line => line.startsWith('Versi...
devchat-vscode/src/util/python_installer/pip_package_version.ts/0
{ "file_path": "devchat-vscode/src/util/python_installer/pip_package_version.ts", "repo_id": "devchat-vscode", "token_count": 180 }
18
// test/util/logger.test.ts import { expect } from 'chai'; import { describe, it } from 'mocha'; import { logger, LogChannel } from '../../src/util/logger'; class MockLogChannel implements LogChannel { logs: string[] = []; info(message: string, ...args: any[]): void { this.logs.push(`[INFO] ${message} ${args...
devchat-vscode/test/util/logger.test.ts/0
{ "file_path": "devchat-vscode/test/util/logger.test.ts", "repo_id": "devchat-vscode", "token_count": 601 }
19
import sys if __name__ == "__main__": from devchat._cli.main import main as _main sys.exit(_main())
devchat/devchat/__main__.py/0
{ "file_path": "devchat/devchat/__main__.py", "repo_id": "devchat", "token_count": 41 }
20
from abc import ABC, abstractmethod from typing import Iterator from devchat.prompt import Prompt class Chat(ABC): """ Chat interface for managing chat-related interactions. This interface defines methods for prompting a chat system with a list of Message objects and retrieving responses, either as a...
devchat/devchat/chat.py/0
{ "file_path": "devchat/devchat/chat.py", "repo_id": "devchat", "token_count": 602 }
21
import os from typing import List from .command_runner import CommandRunner from .util import CommandUtil from .namespace import Namespace from.recursive_prompter import RecursivePrompter def load_workflow_instruction(user_input: str): user_input = user_input.strip() if len(user_input) == 0: return No...
devchat/devchat/engine/router.py/0
{ "file_path": "devchat/devchat/engine/router.py", "repo_id": "devchat", "token_count": 712 }
22
import os import shutil import tempfile from pathlib import Path import pytest from git import Repo @pytest.fixture(scope='function') def git_repo(request): # Create a temporary directory repo_dir = tempfile.mkdtemp() # Initialize a new Git repository in the temporary directory Repo.init(repo_dir) ...
devchat/tests/conftest.py/0
{ "file_path": "devchat/tests/conftest.py", "repo_id": "devchat", "token_count": 434 }
23
# pylint: disable=protected-access import json import os import pytest from devchat.message import Message from devchat.openai import OpenAIMessage from devchat.openai import OpenAIPrompt from devchat.utils import get_user_info def test_prompt_init_and_set_response(): name, email = get_user_info() prompt = Op...
devchat/tests/test_openai_prompt.py/0
{ "file_path": "devchat/tests/test_openai_prompt.py", "repo_id": "devchat", "token_count": 3022 }
24
### 操作指南 生成行间注释,请按照如下步骤操作: 1. 选中行间代码。 2. 输入\/comments,回车发送;或右键点击**DevChat: Generate Comments**按钮。 3. 开始生成行间注释,等待生成结束。 4. 自动弹出Diff View,选择是否接受修改。 如图所示: ![图片](https://deploy-script.merico.cn/devchat/workflow/readme_comments.gif)
workflows/comments/README.md/0
{ "file_path": "workflows/comments/README.md", "repo_id": "workflows", "token_count": 239 }
25
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/docstring/main.py/0
{ "file_path": "workflows/docstring/main.py", "repo_id": "workflows", "token_count": 1511 }
26
import json from typing import List, Tuple from devchat.llm.openai import chat_completion_no_stream_return_json from llm_conf import ( USE_USER_MODEL, USER_LLM_MODEL, ) from openai_util import create_chat_completion_content MODEL = USER_LLM_MODEL if USE_USER_MODEL else "gpt-4-turbo-preview" # ruff: noqa: E50...
workflows/unit_tests/assistants/rerank_files.py/0
{ "file_path": "workflows/unit_tests/assistants/rerank_files.py", "repo_id": "workflows", "token_count": 1234 }
27
import json from functools import partial from typing import List, Optional from devchat.llm.openai import chat_completion_no_stream_return_json from find_context import Context from llm_conf import ( CONTEXT_SIZE, DEFAULT_CONTEXT_SIZE, DEFAULT_ENCODING, USE_USER_MODEL, USER_LLM_MODEL, ) from model...
workflows/unit_tests/propose_test.py/0
{ "file_path": "workflows/unit_tests/propose_test.py", "repo_id": "workflows", "token_count": 1961 }
28
import sys a = float(sys.argv[1]) b = float(sys.argv[2]) print('the result is:', a+b)
LabWorkflows/code_interpreter/sum.py/0
{ "file_path": "LabWorkflows/code_interpreter/sum.py", "repo_id": "LabWorkflows", "token_count": 41 }
0
import sys import os 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 llm_api import ( chat, FixSizeChatMemory ) mem...
LabWorkflows/llm_demo/chat_with_memory/command.py/0
{ "file_path": "LabWorkflows/llm_demo/chat_with_memory/command.py", "repo_id": "LabWorkflows", "token_count": 552 }
1
description: 'Run python code to achieve a goal.' input: required steps: - run: $devchat_python $command_path/command.py "$input"
LabWorkflows/use_code/command.yml/0
{ "file_path": "LabWorkflows/use_code/command.yml", "repo_id": "LabWorkflows", "token_count": 39 }
2
<?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="Encoding" defaultCharsetForPropertiesFiles="UTF-8" /> </project>
devchat-intellij/.idea/encodings.xml/0
{ "file_path": "devchat-intellij/.idea/encodings.xml", "repo_id": "devchat-intellij", "token_count": 49 }
3
## Query Topic List ### JS to Java ```json { "action": "listTopics/request", "metadata": { "callback": "responseFunctionName" }, "payload": null } ``` ### Java to JS ```json { "action": "listTopics/response", "metadata": { "status": "success", "error": "" }, "payload": { "topics": [ ...
devchat-intellij/api/topic.md/0
{ "file_path": "devchat-intellij/api/topic.md", "repo_id": "devchat-intellij", "token_count": 1515 }
4
package ai.devchat.core import ai.devchat.common.Log import ai.devchat.plugin.browser import com.alibaba.fastjson.JSONObject const val DEFAULT_RESPONSE_FUNC = "IdeaToJSMessage" abstract class BaseActionHandler( val requestAction: String, var metadata: JSONObject? = null, var payload: JSONObject? = null )...
devchat-intellij/src/main/kotlin/ai/devchat/core/BaseActionHandler.kt/0
{ "file_path": "devchat-intellij/src/main/kotlin/ai/devchat/core/BaseActionHandler.kt", "repo_id": "devchat-intellij", "token_count": 621 }
5
package ai.devchat.core.handlers import ai.devchat.core.BaseActionHandler import ai.devchat.core.DevChatActions import ai.devchat.storage.DevChatState import com.alibaba.fastjson.JSONArray import com.alibaba.fastjson.JSONObject class ListTopicsRequestHandler(requestAction: String, metadata: JSONObject?, payload: JSO...
devchat-intellij/src/main/kotlin/ai/devchat/core/handlers/ListTopicsRequestHandler.kt/0
{ "file_path": "devchat-intellij/src/main/kotlin/ai/devchat/core/handlers/ListTopicsRequestHandler.kt", "repo_id": "devchat-intellij", "token_count": 494 }
6
package ai.devchat.plugin import ai.devchat.common.Log import ai.devchat.core.ActionHandlerFactory import ai.devchat.core.DevChatActions import ai.devchat.core.handlers.AddContextNotifyHandler import ai.devchat.core.handlers.SendUserMessageHandler import ai.devchat.plugin.actions.AddToDevChatAction import com.alibaba....
devchat-intellij/src/main/kotlin/ai/devchat/plugin/Browser.kt/0
{ "file_path": "devchat-intellij/src/main/kotlin/ai/devchat/plugin/Browser.kt", "repo_id": "devchat-intellij", "token_count": 2848 }
7
package ai.devchat.plugin.hints import ai.devchat.common.DevChatBundle import com.intellij.codeInsight.codeVision.settings.CodeVisionGroupSettingProvider class ExplainCodeCVSettingsProvider : CodeVisionGroupSettingProvider { override val groupId: String get() = "explainCode" override val groupName: String ...
devchat-intellij/src/main/kotlin/ai/devchat/plugin/hints/ExplainCodeCVSettingsProvider.kt/0
{ "file_path": "devchat-intellij/src/main/kotlin/ai/devchat/plugin/hints/ExplainCodeCVSettingsProvider.kt", "repo_id": "devchat-intellij", "token_count": 153 }
8
{ "root": true, "parser": "@typescript-eslint/parser", "parserOptions": { "ecmaVersion": 6, "sourceType": "module" }, "plugins": [ "@typescript-eslint" ], "rules": { "@typescript-eslint/naming-convention": "warn", "@typescript-eslint/semi": "warn", ...
devchat-vscode/.eslintrc.json/0
{ "file_path": "devchat-vscode/.eslintrc.json", "repo_id": "devchat-vscode", "token_count": 285 }
9
// See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format { "version": "2.0.0", "tasks": [ { "type": "npm", "script": "watch", "problemMatcher": "$ts-webpack-watch", "isBackground": true, "presentation": { "reveal": "never", "group": "watchers"...
devchat-vscode/.vscode/tasks.json/0
{ "file_path": "devchat-vscode/.vscode/tasks.json", "repo_id": "devchat-vscode", "token_count": 360 }
10