text stringlengths 7 1.68M | id stringlengths 17 99 | metadata dict | __index_level_0__ int64 0 33 |
|---|---|---|---|
{
"sha": "779e4edd862c259c4f292739eeb3671a19c44e9330837bcfba6e509521e0acbe",
"command_python": "/Users/admin/.chat/mamba/envs/code_interpreter/bin/python"
} | LabWorkflows/code_interpreter/runtime.json/0 | {
"file_path": "LabWorkflows/code_interpreter/runtime.json",
"repo_id": "LabWorkflows",
"token_count": 82
} | 0 |
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/update_issue_tasks/command.py/0 | {
"file_path": "LabWorkflows/git/update_issue_tasks/command.py",
"repo_id": "LabWorkflows",
"token_count": 1246
} | 1 |
description: "demo for chat confirm"
steps:
- run: $devchat_python $command_path/command.py | LabWorkflows/llm_demo/chat_with_confirm/command.yml/0 | {
"file_path": "LabWorkflows/llm_demo/chat_with_confirm/command.yml",
"repo_id": "LabWorkflows",
"token_count": 30
} | 2 |
import os
import sys
import json
from typing import Optional
from pr_agent.git_providers.git_provider import GitProvider, IncrementalPR
from pr_agent.git_providers.github_provider import GithubProvider
import pr_agent.git_providers as git_providers
from devchat.chatmark import Form, TextEditor, Button
class DevChatP... | LabWorkflows/pr/providers/devchat_provider.py/0 | {
"file_path": "LabWorkflows/pr/providers/devchat_provider.py",
"repo_id": "LabWorkflows",
"token_count": 3744
} | 3 |
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/use_code/command.py/0 | {
"file_path": "LabWorkflows/use_code/command.py",
"repo_id": "LabWorkflows",
"token_count": 747
} | 4 |
description: list workflows.
input: optional
steps:
- run: $devchat_python $command_path/command.py | LabWorkflows/workflow/list/command.yml/0 | {
"file_path": "LabWorkflows/workflow/list/command.yml",
"repo_id": "LabWorkflows",
"token_count": 31
} | 5 |
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component> | devchat-intellij/.idea/codeStyles/codeStyleConfig.xml/0 | {
"file_path": "devchat-intellij/.idea/codeStyles/codeStyleConfig.xml",
"repo_id": "devchat-intellij",
"token_count": 47
} | 6 |
## Get Setting
### JS to Java
```json
{
"action": "getSetting/request",
"metadata": {
"callback": "responseFunctionName"
},
"payload": null
}
```
### Java to JS
- success
```json
{
"action": "getSetting/response",
"metadata": {
"status": "success",
"error": ""
},
"payload": {
"setti... | devchat-intellij/api/setting.md/0 | {
"file_path": "devchat-intellij/api/setting.md",
"repo_id": "devchat-intellij",
"token_count": 565
} | 7 |
package ai.devchat.core
import ai.devchat.core.handlers.*
import com.alibaba.fastjson.JSONObject
import kotlin.reflect.KClass
import kotlin.reflect.full.primaryConstructor
class ActionHandlerFactory {
private val actionHandlerMap: Map<String, KClass<out ActionHandler>> = mapOf(
DevChatActions.SEND_MESSAGE... | devchat-intellij/src/main/kotlin/ai/devchat/core/ActionHandlerFactory.kt/0 | {
"file_path": "devchat-intellij/src/main/kotlin/ai/devchat/core/ActionHandlerFactory.kt",
"repo_id": "devchat-intellij",
"token_count": 1027
} | 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 ListModelsRequestHandler(requestAction: String, metadata: JSONObject?, payload: JSONObject?) : BaseActionHandler(
requestAct... | devchat-intellij/src/main/kotlin/ai/devchat/core/handlers/ListModelsRequestHandler.kt/0 | {
"file_path": "devchat-intellij/src/main/kotlin/ai/devchat/core/handlers/ListModelsRequestHandler.kt",
"repo_id": "devchat-intellij",
"token_count": 199
} | 9 |
package ai.devchat.installer
import ai.devchat.common.Log
import ai.devchat.common.OSInfo
import java.io.File
import java.io.IOException
import java.nio.file.Paths
/**
* DevChat represents for the DevChat Python CLI
*/
class PythonEnvManager(private val workDir: String) {
private val mambaWorkDir = Paths.get(w... | devchat-intellij/src/main/kotlin/ai/devchat/installer/PythonEnvManager.kt/0 | {
"file_path": "devchat-intellij/src/main/kotlin/ai/devchat/installer/PythonEnvManager.kt",
"repo_id": "devchat-intellij",
"token_count": 2797
} | 10 |
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.psi.*
import com.intellij.refactoring.suggested.endOffset
import com.intellij.refactoring.suggested.startOffset
im... | devchat-intellij/src/main/kotlin/ai/devchat/plugin/hints/ExplainCodeCVProvider.kt/0 | {
"file_path": "devchat-intellij/src/main/kotlin/ai/devchat/plugin/hints/ExplainCodeCVProvider.kt",
"repo_id": "devchat-intellij",
"token_count": 507
} | 11 |
version: 2.1
executors:
node-executor:
docker:
- image: cimg/node:20.2.0
jobs:
build:
executor: node-executor
steps:
- checkout
- run: git submodule sync
- run: git submodule update --init
- run: npm install
- run: npm run build
- persist_to_workspace:
... | devchat-vscode/.circleci/config.yml/0 | {
"file_path": "devchat-vscode/.circleci/config.yml",
"repo_id": "devchat-vscode",
"token_count": 1201
} | 12 |
// A launch configuration that compiles the extension and then opens it inside a new window
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations... | devchat-vscode/.vscode/launch.json/0 | {
"file_path": "devchat-vscode/.vscode/launch.json",
"repo_id": "devchat-vscode",
"token_count": 404
} | 13 |
{
"name": "devchat",
"displayName": "DevChat",
"description": "Write prompts, not code",
"version": "0.1.74",
"icon": "assets/devchat.png",
"publisher": "merico",
"engines": {
"vscode": "^1.75.0"
},
"repository": {
"type": "git",
"url": "https://github.com/devchat-ai/devchat-vscode.git"
... | devchat-vscode/package.json/0 | {
"file_path": "devchat-vscode/package.json",
"repo_id": "devchat-vscode",
"token_count": 17303
} | 14 |
/*
针对代码补全功能,构建prompt
prompt的好坏,取决于提供的上下文信息。
通过AST获取相对完整的信息,可能会增加提示的准确度,但也会增加代码提示的复杂度。
*/
import { logger } from "../../../util/logger";
import * as vscode from "vscode";
import { getAst, getTreePathAtCursor, RangeInFileWithContents } from "./ast";
import Parser from "web-tree-sitter";
import { getCommentPrefix, g... | devchat-vscode/src/contributes/codecomplete/ast/findIdentifiers.ts/0 | {
"file_path": "devchat-vscode/src/contributes/codecomplete/ast/findIdentifiers.ts",
"repo_id": "devchat-vscode",
"token_count": 1667
} | 15 |
// import { IDE, RangeInFile } from "core";
import { getAst, getTreePathAtCursor, RangeInFileWithContents } from "./ast/ast";
import { AutocompleteSnippet } from "./ranking";
import * as vscode from "vscode";
import Parser from "web-tree-sitter";
import { RangeInFile, readRangeInFile } from "./utils";
type GotoProvide... | devchat-vscode/src/contributes/codecomplete/lsp.ts/0 | {
"file_path": "devchat-vscode/src/contributes/codecomplete/lsp.ts",
"repo_id": "devchat-vscode",
"token_count": 2282
} | 16 |
import { UiUtilWrapper } from '../util/uiUtil';
import { MessageHandler } from './messageHandler';
import { isSending } from './sendMessage';
export async function chatWithDevChat(panel, message: string) {
if (isSending()) {
// already sending, show error
UiUtilWrapper.showErrorMessage("DevChat: A command is alr... | devchat-vscode/src/handler/chatHandler.ts/0 | {
"file_path": "devchat-vscode/src/handler/chatHandler.ts",
"repo_id": "devchat-vscode",
"token_count": 143
} | 17 |
import * as vscode from 'vscode';
import { MessageHandler } from './messageHandler';
import { regInMessage, regOutMessage } from '../util/reg_messages';
import {
stopDevChatBase,
sendMessageBase,
deleteChatMessageBase,
sendTextToDevChat
} from './sendMessageBase';
import { UiUtilWrapper } from '../util/ui... | devchat-vscode/src/handler/sendMessage.ts/0 | {
"file_path": "devchat-vscode/src/handler/sendMessage.ts",
"repo_id": "devchat-vscode",
"token_count": 1726
} | 18 |
import * as vscode from "vscode";
import * as path from "path";
// TODO: merge with find-defs.ts
interface Reference {
name: string;
abspath: string;
line: number; // 1-based
character: number; // 1-based
}
/**
* @param abspath: absolute path of the file
* @param line: line number, 1-based
* @para... | devchat-vscode/src/ide_services/endpoints/legacy_bridge/feature/find-refs.ts/0 | {
"file_path": "devchat-vscode/src/ide_services/endpoints/legacy_bridge/feature/find-refs.ts",
"repo_id": "devchat-vscode",
"token_count": 686
} | 19 |
/*
Util for askCode
*/
import * as fs from 'fs';
import * as path from 'path';
import { UiUtilWrapper } from './uiUtil';
let indexingStatus = 'stopped'; // 'started' | 'indexing' | 'stopped'
export function updateLastModifyTime() {
const workspaceFolder = UiUtilWrapper.workspaceFoldersFirstPath();
if (!workspaceFo... | devchat-vscode/src/util/askCodeUtil.ts/0 | {
"file_path": "devchat-vscode/src/util/askCodeUtil.ts",
"repo_id": "devchat-vscode",
"token_count": 674
} | 20 |
/*
Install DevChat with python=3.11.4
*/
import { logger } from "../logger";
import { appInstall, createEnvByConda, createEnvByMamba } from "./app_install";
import * as os from 'os';
import * as path from 'path';
import * as fs from 'fs';
import { UiUtilWrapper } from "../uiUtil";
import { DevChatConfig } from "../... | devchat-vscode/src/util/python_installer/install_devchat.ts/0 | {
"file_path": "devchat-vscode/src/util/python_installer/install_devchat.ts",
"repo_id": "devchat-vscode",
"token_count": 1015
} | 21 |
import { expect } from 'chai';
import { describe, it, beforeEach, afterEach } from 'mocha';
import fs from 'fs';
import yaml from 'yaml';
import { DevChatConfig } from '../../src/util/config'; // 调整路径以指向config.ts的实际位置
import sinon from 'sinon';
import { logger } from '../../src/util/logger'; // 调整路径以指向logger的实际位置
desc... | devchat-vscode/test/util/config.test.ts/0 | {
"file_path": "devchat-vscode/test/util/config.test.ts",
"repo_id": "devchat-vscode",
"token_count": 817
} | 22 |
<div align="center">

# DevChat: Intelligent Scripts that Streamline Your Dev Workflows
[](http://makeapullrequest.com)
[![Circ... | devchat/README.md/0 | {
"file_path": "devchat/README.md",
"repo_id": "devchat",
"token_count": 1767
} | 23 |
from typing import List, Optional, Dict, Any
from pydantic import BaseModel, Field
class AnthropicChatParameters(BaseModel, extra='ignore'):
max_tokens_to_sample: int = Field(1024, ge=1)
stop_sequences: Optional[List[str]]
temperature: Optional[float] = Field(0.2, ge=0, le=1)
top_p: Optional[float]
... | devchat/devchat/anthropic/anthropic_chat.py/0 | {
"file_path": "devchat/devchat/anthropic/anthropic_chat.py",
"repo_id": "devchat",
"token_count": 156
} | 24 |
import os
from typing import List, Optional
import re
class Namespace:
def __init__(self, root_path: str,
branches: List[str] = None):
"""
:param root_path: The root path of the namespace.
:param branches: The hidden branches with ascending order of priority.
"""
... | devchat/devchat/engine/namespace.py/0 | {
"file_path": "devchat/devchat/engine/namespace.py",
"repo_id": "devchat",
"token_count": 2290
} | 25 |
from .base import ChatMemory
from .fixsize_memory import FixSizeChatMemory
__all__ = [
"ChatMemory",
"FixSizeChatMemory",
]
| devchat/devchat/memory/__init__.py/0 | {
"file_path": "devchat/devchat/memory/__init__.py",
"repo_id": "devchat",
"token_count": 47
} | 26 |
import sys
from tinydb import TinyDB
def remove_topic_table(file_path: str):
try:
db = TinyDB(file_path)
if 'topics' in db.tables():
db.drop_table('topics')
print("The 'topics' table has been removed.")
else:
print("The file does not contain a 'topics' t... | devchat/scripts/purge_topics.py/0 | {
"file_path": "devchat/scripts/purge_topics.py",
"repo_id": "devchat",
"token_count": 273
} | 27 |
import os
import pytest
from devchat.engine import Namespace
def test_is_valid_name():
# Test valid names
assert Namespace.is_valid_name('') is True
assert Namespace.is_valid_name('a') is True
assert Namespace.is_valid_name('A.b') is True
assert Namespace.is_valid_name('a.2.c') is True
assert ... | devchat/tests/test_namespace.py/0 | {
"file_path": "devchat/tests/test_namespace.py",
"repo_id": "devchat",
"token_count": 2382
} | 28 |
description: Generate code with a Python-specific template embedded into the prompt. | workflows/code/py/command.yml/0 | {
"file_path": "workflows/code/py/command.yml",
"repo_id": "workflows",
"token_count": 16
} | 29 |
### 操作指南
生成函数注释,请按照如下步骤操作:
1. 选中函数代码。
2. 输入\/docstring,回车发送;或点击函数头部**docstring**按钮。
3. 开始生成函数注释,等待生成结束。
4. 自动弹出Diff View,选择是否接受修改。
如图所示:
 | workflows/docstring/README.md/0 | {
"file_path": "workflows/docstring/README.md",
"repo_id": "workflows",
"token_count": 240
} | 30 |
import os
import sys
import time
sys.path.append(os.path.join(os.path.dirname(__file__), "..", "libs"))
sys.path.append(os.path.join(os.path.dirname(__file__), "..", "..", "libs"))
from chatmark import Button, Checkbox, Form, Radio, Step, TextEditor # noqa: E402
def main():
print("\n\n---\n\n")
# Step
... | workflows/libs/chatmark/chatmark_example/main.py/0 | {
"file_path": "workflows/libs/chatmark/chatmark_example/main.py",
"repo_id": "workflows",
"token_count": 2002
} | 31 |
import json
from pathlib import Path
from typing import Callable, List
from assistants.directory_structure.base import DirectoryStructureBase
from assistants.rerank_files import rerank_files
from devchat.llm.openai import chat_completion_no_stream_return_json
from llm_conf import (
CONTEXT_SIZE,
DEFAULT_CONTEX... | workflows/unit_tests/assistants/directory_structure/relevant_file_finder.py/0 | {
"file_path": "workflows/unit_tests/assistants/directory_structure/relevant_file_finder.py",
"repo_id": "workflows",
"token_count": 2340
} | 32 |
import os
from typing import Optional
from openai import OpenAI, Stream
from openai.types.chat import ChatCompletionChunk
from tenacity import retry, stop_after_attempt, wait_random_exponential
# TODO: make this file a common module
def create_chat_completion_chunks(
client: Optional[OpenAI] = None, **kwargs
) ... | workflows/unit_tests/openai_util.py/0 | {
"file_path": "workflows/unit_tests/openai_util.py",
"repo_id": "workflows",
"token_count": 594
} | 33 |
prompts:
[
'write python script: {{topic}}',
]
providers:
- id: "exec:python llm_openai.py"
- id: "exec:python llm_devchat.py"
tests:
- vars:
topic: write python http server
| LabWorkflows/git/commit/test/prompt/promptfooconfig.yaml/0 | {
"file_path": "LabWorkflows/git/commit/test/prompt/promptfooconfig.yaml",
"repo_id": "LabWorkflows",
"token_count": 84
} | 0 |
description: 'Create new PR.'
steps:
- run: $devchat_python $command_path/command.py | LabWorkflows/git/new_pr/command.yml/0 | {
"file_path": "LabWorkflows/git/new_pr/command.yml",
"repo_id": "LabWorkflows",
"token_count": 28
} | 1 |
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,
llm_edit_confirm,
)
@l... | LabWorkflows/llm_demo/chat_with_confirm/command.py/0 | {
"file_path": "LabWorkflows/llm_demo/chat_with_confirm/command.py",
"repo_id": "LabWorkflows",
"token_count": 281
} | 2 |
"""
当前脚本用于实现 /workflow.local_install命令
具体步骤有:
-> step1: 选择需要安装的command, 候选列表来自于~/.chat/workflows/usr下子目录列表
-> step2: 安装依赖环境。调用IDE服务,安装依赖环境,输入参数为command_name, requirements.txt文件路径。返回值为安装后的python路径。
-> step3: 更新command列表。调用IDE服务,更新command列表
"""
import os
import sys
import requests
sys.path.append(os.path.join(os.path.e... | LabWorkflows/workflow/list/command.py/0 | {
"file_path": "LabWorkflows/workflow/list/command.py",
"repo_id": "LabWorkflows",
"token_count": 553
} | 3 |
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<JetCodeStyleSettings>
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<codeStyleSettings language="kotlin">
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICI... | devchat-intellij/.idea/codeStyles/Project.xml/0 | {
"file_path": "devchat-intellij/.idea/codeStyles/Project.xml",
"repo_id": "devchat-intellij",
"token_count": 143
} | 4 |
## List models
### JS to Java
```json
{
"action": "listModels/request",
"metadata": {
"callback": "responseFunctionName"
},
"payload": null
}
```
### Java to JS
```json
{
"action": "listModels/response",
"metadata": {
"status": "success",
"error": ""
},
"payload": {
"models": [
... | devchat-intellij/api/model.md/0 | {
"file_path": "devchat-intellij/api/model.md",
"repo_id": "devchat-intellij",
"token_count": 171
} | 5 |
package ai.devchat.core
interface ActionHandler {
fun executeAction()
}
| devchat-intellij/src/main/kotlin/ai/devchat/core/ActionHandler.kt/0 | {
"file_path": "devchat-intellij/src/main/kotlin/ai/devchat/core/ActionHandler.kt",
"repo_id": "devchat-intellij",
"token_count": 25
} | 6 |
package ai.devchat.core.handlers
import ai.devchat.core.BaseActionHandler
import ai.devchat.core.DevChatActions
import com.alibaba.fastjson.JSONObject
class ListContextsRequestHandler(requestAction: String, metadata: JSONObject?, payload: JSONObject?) : BaseActionHandler(
requestAction,
metadata,
payload... | devchat-intellij/src/main/kotlin/ai/devchat/core/handlers/ListContextsRequestHandler.kt/0 | {
"file_path": "devchat-intellij/src/main/kotlin/ai/devchat/core/handlers/ListContextsRequestHandler.kt",
"repo_id": "devchat-intellij",
"token_count": 355
} | 7 |
package ai.devchat.installer
import ai.devchat.storage.DevChatConfig
import ai.devchat.core.DevChatWrapper
import ai.devchat.common.Log
import ai.devchat.common.OSInfo
import ai.devchat.common.PathUtils
import ai.devchat.common.Notifier
import ai.devchat.plugin.browser
import ai.devchat.storage.CONFIG
import ai.devcha... | devchat-intellij/src/main/kotlin/ai/devchat/installer/DevChatSetupThread.kt/0 | {
"file_path": "devchat-intellij/src/main/kotlin/ai/devchat/installer/DevChatSetupThread.kt",
"repo_id": "devchat-intellij",
"token_count": 2308
} | 8 |
package ai.devchat.plugin.hints
import ai.devchat.common.DevChatBundle
import com.intellij.codeInsight.codeVision.settings.CodeVisionGroupSettingProvider
class DocStringCVSettingsProvider : CodeVisionGroupSettingProvider {
override val groupId: String
get() = "docstring"
override val groupName: String
ge... | devchat-intellij/src/main/kotlin/ai/devchat/plugin/hints/DocStringCVSettingsProvider.kt/0 | {
"file_path": "devchat-intellij/src/main/kotlin/ai/devchat/plugin/hints/DocStringCVSettingsProvider.kt",
"repo_id": "devchat-intellij",
"token_count": 150
} | 9 |
setTimeout(function () {
console.log("wait...")
}, 2000);
function displayResponseFromJava(message) {
document.getElementById('response').innerHTML = JSON.stringify(message, null, 2);
}
document.getElementById('sendButton').addEventListener('click', function () {
var el = document.getElementById('textInpu... | devchat-intellij/src/main/resources/static/main.js/0 | {
"file_path": "devchat-intellij/src/main/resources/static/main.js",
"repo_id": "devchat-intellij",
"token_count": 141
} | 10 |
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": ["dbaeumer.vscode-eslint", "amodio.tsl-problem-matcher"]
}
| devchat-vscode/.vscode/extensions.json/0 | {
"file_path": "devchat-vscode/.vscode/extensions.json",
"repo_id": "devchat-vscode",
"token_count": 70
} | 11 |
/*
针对代码补全功能,构建prompt
prompt的好坏,取决于提供的上下文信息。
通过AST获取相对完整的信息,可能会增加提示的准确度,但也会增加代码提示的复杂度。
*/
import { logger } from "../../../util/logger";
import * as vscode from "vscode";
import { getAst, getTreePathAtCursor, RangeInFileWithContents } from "./ast";
import Parser from "web-tree-sitter";
import { getCommentPrefix, g... | devchat-vscode/src/contributes/codecomplete/ast/findFunctions.ts/0 | {
"file_path": "devchat-vscode/src/contributes/codecomplete/ast/findFunctions.ts",
"repo_id": "devchat-vscode",
"token_count": 1832
} | 12 |
// @ts-ignore
import llamaTokenizer from "llama-tokenizer-js";
//import { ChatMessage, MessageContent, MessagePart } from "..";
import { TOKEN_BUFFER_FOR_SAFETY } from "./constants";
export type ChatMessageRole = "user" | "assistant" | "system";
export interface MessagePart {
type: "text" | "imageUrl";
text?: st... | devchat-vscode/src/contributes/codecomplete/llm/countTokens.ts/0 | {
"file_path": "devchat-vscode/src/contributes/codecomplete/llm/countTokens.ts",
"repo_id": "devchat-vscode",
"token_count": 3309
} | 13 |
import * as vscode from "vscode";
import {
registerOpenChatPanelCommand,
registerAddContextCommand,
registerAskForCodeCommand,
registerAskForFileCommand,
regApplyDiffResultCommand,
registerStatusBarItemClickCommand,
regPythonPathCommand,
registerInstallCommandsCommand,
registerDevChatChat... | devchat-vscode/src/extension.ts/0 | {
"file_path": "devchat-vscode/src/extension.ts",
"repo_id": "devchat-vscode",
"token_count": 1967
} | 14 |
import * as vscode from 'vscode';
import { MessageHandler } from './messageHandler';
import { regInMessage, regOutMessage } from '../util/reg_messages';
import { ApiKeyManager } from '../util/apiKey';
import { UiUtilWrapper } from '../util/uiUtil';
regInMessage({command: 'regModelList'});
regOutMessage({command: 're... | devchat-vscode/src/handler/removehandler.ts/0 | {
"file_path": "devchat-vscode/src/handler/removehandler.ts",
"repo_id": "devchat-vscode",
"token_count": 704
} | 15 |
import * as vscode from "vscode";
interface Definition {
name: string;
abspath: string;
line: number; // 1-based
character: number; // 1-based
}
/**
* @param abspath: absolute path of the file
* @param line: line number, 1-based
* @param character: character number, 1-based
*
**/
async function f... | devchat-vscode/src/ide_services/endpoints/legacy_bridge/feature/find-defs.ts/0 | {
"file_path": "devchat-vscode/src/ide_services/endpoints/legacy_bridge/feature/find-defs.ts",
"repo_id": "devchat-vscode",
"token_count": 1677
} | 16 |
import { logger } from "./logger";
type Action = {
action: "delete" | "insert" | "modify";
content?: string;
// eslint-disable-next-line @typescript-eslint/naming-convention
insert_after?: string;
// eslint-disable-next-line @typescript-eslint/naming-convention
insert_before?: string;
// eslint-disable-next-li... | devchat-vscode/src/util/appyDiff.ts/0 | {
"file_path": "devchat-vscode/src/util/appyDiff.ts",
"repo_id": "devchat-vscode",
"token_count": 2218
} | 17 |
import * as fs from 'fs';
import * as https from 'https';
import * as os from 'os';
import * as path from 'path';
import { logger } from '../logger';
// download url to tmp directory
// return: local file path or empty string
export async function downloadFile(url: string): Promise<string> {
const os = process.platfo... | devchat-vscode/src/util/python_installer/https_download.ts/0 | {
"file_path": "devchat-vscode/src/util/python_installer/https_download.ts",
"repo_id": "devchat-vscode",
"token_count": 584
} | 18 |
// test/commonUtil.test.ts
import { expect } from 'chai';
import * as fs from 'fs';
import * as os from 'os';
import * as path from 'path';
import {
createTempSubdirectory,
CommandRun,
runCommandAndWriteOutput,
runCommandStringAndWriteOutput,
getLanguageIdByFileName,
} from '../../src/util/commonUtil';
import { U... | devchat-vscode/test/util/commonUtil.test.ts/0 | {
"file_path": "devchat-vscode/test/util/commonUtil.test.ts",
"repo_id": "devchat-vscode",
"token_count": 1577
} | 19 |
[flake8]
max-line-length = 100
ignore = E712,W503 | devchat/.flake8/0 | {
"file_path": "devchat/.flake8",
"repo_id": "devchat",
"token_count": 20
} | 20 |
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
... | devchat/LICENSE/0 | {
"file_path": "devchat/LICENSE",
"repo_id": "devchat",
"token_count": 3168
} | 21 |
from .anthropic_chat import AnthropicChatParameters
__all__ = [
'AnthropicChatParameters'
]
| devchat/devchat/anthropic/__init__.py/0 | {
"file_path": "devchat/devchat/anthropic/__init__.py",
"repo_id": "devchat",
"token_count": 32
} | 22 |
"""
Run Command with a input text.
"""
import os
import sys
import json
import threading
import subprocess
from typing import List, Dict
import shlex
from devchat.utils import get_logger
from .command_parser import Command
from .util import ToolUtil
logger = get_logger(__name__)
DEVCHAT_COMMAND_MISS_ERROR_MESSAGE ... | devchat/devchat/engine/command_runner.py/0 | {
"file_path": "devchat/devchat/engine/command_runner.py",
"repo_id": "devchat",
"token_count": 4784
} | 23 |
import json
import os
import sys
from functools import wraps
from devchat.memory import ChatMemory
from devchat.chatmark import Form, Radio, TextEditor
from devchat.ide import IDEService
from .openai import chat_call_completion_stream
class MissToolsFieldException(Exception):
pass
def openai_tool_schema(name,... | devchat/devchat/llm/tools_call.py/0 | {
"file_path": "devchat/devchat/llm/tools_call.py",
"repo_id": "devchat",
"token_count": 3819
} | 24 |
[tool.poetry]
name = "devchat"
version = "0.2.10"
description = "DevChat is an open-source tool that helps developers write prompts to generate code and documentation."
authors = ["DevChat Team <hello@devchat.ai>"]
license = "Apache License 2.0"
readme = "README.md"
homepage = "https://github.com/devchat-ai/devchat"
cl... | devchat/pyproject.toml/0 | {
"file_path": "devchat/pyproject.toml",
"repo_id": "devchat",
"token_count": 517
} | 25 |
import os
from click.testing import CliRunner
from devchat.config import ConfigManager, GeneralModelConfig, ChatConfig
runner = CliRunner()
def test_create_sample_config(tmp_path):
ConfigManager(tmp_path)
assert os.path.exists(os.path.join(tmp_path, 'config.yml'))
def test_load_and_validate_config(tmp_path... | devchat/tests/test_config.py/0 | {
"file_path": "devchat/tests/test_config.py",
"repo_id": "devchat",
"token_count": 461
} | 26 |
[recommend]
workflows = ["unit_tests", "commit", "docstring", "comments", "fix", "explain", "refactor"]
| workflows/configuration.toml/0 | {
"file_path": "workflows/configuration.toml",
"repo_id": "workflows",
"token_count": 35
} | 27 |
# chatmark_exmaple
This is an example of how to use the chatmark module.
Usage:
1. Copy the `chatmark_example` folder under `~/.chat/workflow/org`
2. Create `command.yml` under `~/.chat/workflow/org/chatmark_example` with the following content:
```yaml
description: chatmark examples
steps:
- run: $command_python ... | workflows/libs/chatmark/chatmark_example/README.md/0 | {
"file_path": "workflows/libs/chatmark/chatmark_example/README.md",
"repo_id": "workflows",
"token_count": 139
} | 28 |
from abc import ABC, abstractmethod
from pathlib import Path
from typing import Any, Callable, Optional
from tools.directory_viewer import mk_repo_file_criteria
class DirectoryStructureBase(ABC):
def __init__(
self,
root_path: str,
chat_language: Optional[str] = None,
) -> None:
... | workflows/unit_tests/assistants/directory_structure/base.py/0 | {
"file_path": "workflows/unit_tests/assistants/directory_structure/base.py",
"repo_id": "workflows",
"token_count": 428
} | 29 |
from dataclasses import dataclass
from typing import Optional
from tools.file_util import retrieve_file_content
class TokenBudgetExceededException(Exception):
pass
class UserCancelledException(Exception):
pass
@dataclass
class FuncToTest:
func_name: str
repo_root: str
file_path: str # relati... | workflows/unit_tests/model.py/0 | {
"file_path": "workflows/unit_tests/model.py",
"repo_id": "workflows",
"token_count": 859
} | 30 |
description: 'Run foundation demo.'
input: required
steps:
- run: $devchat_python $command_path/command.py "$input" | LabWorkflows/foundation_demo/command.yml/0 | {
"file_path": "LabWorkflows/foundation_demo/command.yml",
"repo_id": "LabWorkflows",
"token_count": 35
} | 0 |
description: '为你选定的代码变更生成格式规范的提交信息,并通过 Git 提交。如需要可包含对应 issue 编号(例如,输入“/commit to close #12”)'
hint: to close Issue #issue_number
input: optional
steps:
- run: $devchat_python $command_path/../commit.py "$input" "chinese" | LabWorkflows/git/commit/zh/command.yml/0 | {
"file_path": "LabWorkflows/git/commit/zh/command.yml",
"repo_id": "LabWorkflows",
"token_count": 158
} | 1 |
description: 'Create new PR.'
input: required
steps:
- run: $devchat_python $command_path/command.py "$input" | LabWorkflows/git/update_pr/command.yml/0 | {
"file_path": "LabWorkflows/git/update_pr/command.yml",
"repo_id": "LabWorkflows",
"token_count": 35
} | 2 |
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 (
llm_func,
llm_param,
chat_... | LabWorkflows/llm_demo/tool_call/command.py/0 | {
"file_path": "LabWorkflows/llm_demo/tool_call/command.py",
"repo_id": "LabWorkflows",
"token_count": 504
} | 3 |
description: add doc comment for selected code
steps:
- run: $devchat_python $command_path/../rewrite.py "为选中函数添加文档注释。文档注释中第一行需要插入@DevChatApi,形式如\"\"\"@DevChatApi\n...\"\"\"。函数文档注释中需要包含尽量详细的描述。注释使用英文。" | LabWorkflows/rewrite/api_doc_comment/command.yml/0 | {
"file_path": "LabWorkflows/rewrite/api_doc_comment/command.yml",
"repo_id": "LabWorkflows",
"token_count": 162
} | 4 |
description: new workflow.
input: optional
steps:
- run: $devchat_python $command_path/command.py | LabWorkflows/workflow/new/command.yml/0 | {
"file_path": "LabWorkflows/workflow/new/command.yml",
"repo_id": "LabWorkflows",
"token_count": 30
} | 5 |
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KotlinJpsPluginSettings">
<option name="version" value="1.9.23" />
</component>
</project> | devchat-intellij/.idea/kotlinc.xml/0 | {
"file_path": "devchat-intellij/.idea/kotlinc.xml",
"repo_id": "devchat-intellij",
"token_count": 64
} | 6 |
package ai.devchat.core
class DevChatResponse {
var user: String? = null
var date: String? = null
var message: String? = null
var promptHash: String? = null
fun update(line: String) : DevChatResponse {
when {
line.startsWith("User: ") -> user = user ?: line.substring("User: ".l... | devchat-intellij/src/main/kotlin/ai/devchat/core/DevChatResponse.kt/0 | {
"file_path": "devchat-intellij/src/main/kotlin/ai/devchat/core/DevChatResponse.kt",
"repo_id": "devchat-intellij",
"token_count": 501
} | 7 |
package ai.devchat.core.handlers
import ai.devchat.core.BaseActionHandler
import ai.devchat.core.DevChatActions
import ai.devchat.storage.ActiveConversation
import ai.devchat.storage.CONFIG
import com.alibaba.fastjson.JSONObject
class LoadHistoryMessagesRequestHandler(requestAction: String, metadata: JSONObject?, pay... | devchat-intellij/src/main/kotlin/ai/devchat/core/handlers/LoadHistoryMessagesRequestHandler.kt/0 | {
"file_path": "devchat-intellij/src/main/kotlin/ai/devchat/core/handlers/LoadHistoryMessagesRequestHandler.kt",
"repo_id": "devchat-intellij",
"token_count": 269
} | 8 |
package ai.devchat.plugin
import com.intellij.diff.DiffContentFactory
import com.intellij.diff.DiffManager
import com.intellij.diff.requests.SimpleDiffRequest
import com.intellij.openapi.command.WriteCommandAction
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.fileEditor.FileDocumentManager
impo... | devchat-intellij/src/main/kotlin/ai/devchat/plugin/DiffViewerDialog.kt/0 | {
"file_path": "devchat-intellij/src/main/kotlin/ai/devchat/plugin/DiffViewerDialog.kt",
"repo_id": "devchat-intellij",
"token_count": 1148
} | 9 |
package ai.devchat.plugin.hints
import ai.devchat.common.DevChatBundle
import com.intellij.codeInsight.codeVision.settings.CodeVisionGroupSettingProvider
class UnitTestsCVSettingsProvider : CodeVisionGroupSettingProvider {
override val groupId: String
get() = "unitTests"
override val groupName: String
ge... | devchat-intellij/src/main/kotlin/ai/devchat/plugin/hints/UnitTestsCVSettingsProvider.kt/0 | {
"file_path": "devchat-intellij/src/main/kotlin/ai/devchat/plugin/hints/UnitTestsCVSettingsProvider.kt",
"repo_id": "devchat-intellij",
"token_count": 154
} | 10 |
# Change Log
All notable changes to the "devchat" extension will be documented in this file.
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
## [Unreleased]
- Initial release | devchat-vscode/CHANGELOG.md/0 | {
"file_path": "devchat-vscode/CHANGELOG.md",
"repo_id": "devchat-vscode",
"token_count": 62
} | 11 |
import * as path from 'path';
import { ChatContext } from './contextManager';
import { createTempSubdirectory, runCommandStringAndWriteOutput } from '../util/commonUtil';
import { logger } from '../util/logger';
import { UiUtilWrapper } from '../util/uiUtil';
export const customCommandContext: ChatContext = {
nam... | devchat-vscode/src/context/contextCustomCommand.ts/0 | {
"file_path": "devchat-vscode/src/context/contextCustomCommand.ts",
"repo_id": "devchat-vscode",
"token_count": 520
} | 12 |
import * as fs from 'fs';
import Parser from "web-tree-sitter";
import { BlockInfo, FileBlockInfo } from "./types";
import { getAst } from "../ast/ast";
import { findFunctionRanges } from "../ast/findFunctions";
import { FunctionInfo, splitFileIntoBlocks } from "../symbolindex/embedding";
import { findIdentifiers } fro... | devchat-vscode/src/contributes/codecomplete/astIndex/createIdentifierSet.ts/0 | {
"file_path": "devchat-vscode/src/contributes/codecomplete/astIndex/createIdentifierSet.ts",
"repo_id": "devchat-vscode",
"token_count": 1591
} | 13 |
import { RangeInFileWithContents } from "./ast/ast";
import { countTokens } from "./llm/countTokens";
import { Range } from "./utils";
export type AutocompleteSnippet = RangeInFileWithContents & {
score: number;
};
const rx = /[\s.,\/#!$%\^&\*;:{}=\-_`~()\[\]]/g;
function getSymbolsForSnippet(snippet: string): Se... | devchat-vscode/src/contributes/codecomplete/ranking.ts/0 | {
"file_path": "devchat-vscode/src/contributes/codecomplete/ranking.ts",
"repo_id": "devchat-vscode",
"token_count": 3054
} | 14 |
/*
Commands for handling configuration read and write
*/
import * as vscode from 'vscode';
import { regInMessage, regOutMessage } from '../util/reg_messages';
import { MessageHandler } from './messageHandler';
import { DevChatConfig } from '../util/config';
regInMessage({command: 'readConfig', key: ['A','B']}); // wh... | devchat-vscode/src/handler/configHandler.ts/0 | {
"file_path": "devchat-vscode/src/handler/configHandler.ts",
"repo_id": "devchat-vscode",
"token_count": 503
} | 15 |
/*
execute vscode command
*/
import * as vscode from 'vscode';
import { regInMessage, regOutMessage } from '../util/reg_messages';
import { logger } from '../util/logger';
regInMessage({command: 'doCommand', content: ['command', 'arg1', 'arg2']});
export async function doVscodeCommand(message: any, panel: vscode.Webv... | devchat-vscode/src/handler/vscodeCommandHandler.ts/0 | {
"file_path": "devchat-vscode/src/handler/vscodeCommandHandler.ts",
"repo_id": "devchat-vscode",
"token_count": 268
} | 16 |
/* eslint-disable @typescript-eslint/naming-convention */
import * as http from "http";
import * as querystring from "querystring";
import { logger } from "../util/logger";
import { getServicePort } from "./endpoints/getServicePort";
import { installPythonEnv } from "./endpoints/installPythonEnv";
import { ideLogging}... | devchat-vscode/src/ide_services/services.ts/0 | {
"file_path": "devchat-vscode/src/ide_services/services.ts",
"repo_id": "devchat-vscode",
"token_count": 3311
} | 17 |
import fs from 'fs';
import yaml from 'yaml';
import path from 'path';
import { logger } from './logger';
export class DevChatConfig {
private static instance: DevChatConfig;
// 配置文件路径,根据操作系统的差异,可能需要调整
private configFilePath: string;
private data: any;
// last modify timestamp of the config file
... | devchat-vscode/src/util/config.ts/0 | {
"file_path": "devchat-vscode/src/util/config.ts",
"repo_id": "devchat-vscode",
"token_count": 1687
} | 18 |
import { exec, spawn } from 'child_process';
import * as path from 'path';
import * as os from 'os';
import { logger } from '../logger';
const fs = require('fs');
// Check if the environment already exists
export async function checkEnvExists(condaCommandPath: string, envName: string): Promise<boolean> {
return new ... | devchat-vscode/src/util/python_installer/python_install.ts/0 | {
"file_path": "devchat-vscode/src/util/python_installer/python_install.ts",
"repo_id": "devchat-vscode",
"token_count": 2007
} | 19 |
import { expect } from 'chai';
import { describe, it } from 'mocha';
import { MessageHistory } from '../../src/util/messageHistory';
describe('MessageHistory', () => {
let messageHistory: MessageHistory;
beforeEach(() => {
messageHistory = new MessageHistory();
});
it('add message', () => {
const mes... | devchat-vscode/test/util/messageHistory.test.ts/0 | {
"file_path": "devchat-vscode/test/util/messageHistory.test.ts",
"repo_id": "devchat-vscode",
"token_count": 520
} | 20 |
from .log import log
from .prompt import prompt
from .run import run
from .topic import topic
from .route import route
from .command import commands, command, Command
__all__ = [
'log',
'prompt',
'run',
'topic',
'route',
'commands',
'command',
'Command'
]
| devchat/devchat/_cli/__init__.py/0 | {
"file_path": "devchat/devchat/_cli/__init__.py",
"repo_id": "devchat",
"token_count": 106
} | 21 |
# pylint: disable=import-outside-toplevel
import os
import sys
import json
from typing import List, Dict
from devchat._cli.utils import init_dir
from devchat.utils import get_logger
from .namespace import Namespace
from .command_parser import CommandParser, Command
logger = get_logger(__name__)
DEFAULT_MODEL = "g... | devchat/devchat/engine/util.py/0 | {
"file_path": "devchat/devchat/engine/util.py",
"repo_id": "devchat",
"token_count": 2800
} | 22 |
from abc import ABC, abstractmethod
from dataclasses import dataclass
@dataclass
class Message(ABC):
"""
The basic unit of information in a prompt.
"""
content: str = ""
INSTRUCT = "instruct"
CONTEXT = "context"
FUNCTION = "function"
CHAT = "chat"
@abstractmethod
def to_dict(... | devchat/devchat/message.py/0 | {
"file_path": "devchat/devchat/message.py",
"repo_id": "devchat",
"token_count": 300
} | 23 |
{
"choices": [
{
"delta": {
"role": "assistant"
},
"finish_reason": null,
"index": 0
}
],
"created": 1682163460,
"id": "chatcmpl-785qeSHlUo3lH4OnLuovtk3NqLcD6",
"model": "gpt-3.5-turbo-0301",
"object": "chat.completi... | devchat/tests/stream_responses/response1.json/0 | {
"file_path": "devchat/tests/stream_responses/response1.json",
"repo_id": "devchat",
"token_count": 209
} | 24 |
import os
from devchat.engine import Namespace, RecursivePrompter
def test_prompter(tmp_path):
namespace = Namespace(tmp_path)
prompter = RecursivePrompter(namespace)
# Test when there are no 'prompt.txt' files
os.makedirs(os.path.join(tmp_path, 'usr', 'a', 'b', 'c'))
assert prompter.run('a.b.c')... | devchat/tests/test_prompter.py/0 | {
"file_path": "devchat/tests/test_prompter.py",
"repo_id": "devchat",
"token_count": 367
} | 25 |
description: Automatically add doc comments. Select some code and execute this command to generate comments.
steps:
- run: $devchat_python $command_path/main.py
| workflows/comments/command.yml/0 | {
"file_path": "workflows/comments/command.yml",
"repo_id": "workflows",
"token_count": 41
} | 26 |
description: Explain the structure of the repository.
hint: Help me understand the structure of this repo
input: optional
steps:
- run: $command_python $command_path/main.py "$input" | workflows/expl_struct/_command.yml/0 | {
"file_path": "workflows/expl_struct/_command.yml",
"repo_id": "workflows",
"token_count": 48
} | 27 |
[tool.ruff]
line-length = 100
[tool.ruff.lint]
select = ["I"] # Enable the isort rules
extend-select = ["E501"] # explicitly adding the rules | workflows/pyproject.toml/0 | {
"file_path": "workflows/pyproject.toml",
"repo_id": "workflows",
"token_count": 58
} | 28 |
import json
import os
class LocalCache:
"""
A file-based cache for storing and retrieving simple data in JSON format.
"""
DIR = "local_cache"
def __init__(self, name: str, base_path: str):
self._name = name
self._cache = {}
self._base_path = base_path
cache_dir =... | workflows/unit_tests/cache.py/0 | {
"file_path": "workflows/unit_tests/cache.py",
"repo_id": "workflows",
"token_count": 491
} | 29 |
1. 创建一个workflow目录,参考其他workflow实现;
2. 使用shift+command+p运行DevChat: install slash commands,完成/弹出命令的初始化
3. 如果有额外依赖包,使用/workflow.reinstalldeps 选择对应命令执行依赖包安装;
4. 边使用,边调试该workflow。 | LabWorkflows/README.md/0 | {
"file_path": "LabWorkflows/README.md",
"repo_id": "LabWorkflows",
"token_count": 179
} | 0 |
description: Root of git commands. | LabWorkflows/git/command.yml/0 | {
"file_path": "LabWorkflows/git/command.yml",
"repo_id": "LabWorkflows",
"token_count": 7
} | 1 |
import functools
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_pa... | LabWorkflows/git/common_util.py/0 | {
"file_path": "LabWorkflows/git/common_util.py",
"repo_id": "LabWorkflows",
"token_count": 1174
} | 2 |
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 ide_services.vscode_services import (
document_symb... | LabWorkflows/ide_service_demo/command.py/0 | {
"file_path": "LabWorkflows/ide_service_demo/command.py",
"repo_id": "LabWorkflows",
"token_count": 2311
} | 3 |
description: "demo for tool call"
steps:
- run: $devchat_python $command_path/command.py | LabWorkflows/llm_demo/tool_call/command.yml/0 | {
"file_path": "LabWorkflows/llm_demo/tool_call/command.yml",
"repo_id": "LabWorkflows",
"token_count": 30
} | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.