feat:更新导入方式
This commit is contained in:
parent
ae7eb45403
commit
46115bcfba
@ -28,7 +28,7 @@ export class LocalDB<T extends Entity> {
|
||||
const filename = path.join(dbPath, `${this.tableName}.db`);
|
||||
|
||||
if (!dbConnections[filename]) {
|
||||
dbConnections[filename] = new Datastore({
|
||||
dbConnections[filename] = new Datastore.default({
|
||||
filename,
|
||||
autoload: true,
|
||||
timestampData: true
|
||||
|
@ -1,5 +1,5 @@
|
||||
export { routeMessage } from './common/router';
|
||||
export { VSCodeWebViewLike, TaskLoopAdapter } from './hook/adapter';
|
||||
export { setVscodeWorkspace, setRunningCWD } from './hook/setting';
|
||||
export { routeMessage } from './common/router.js';
|
||||
export { VSCodeWebViewLike, TaskLoopAdapter } from './hook/adapter.js';
|
||||
export { setVscodeWorkspace, setRunningCWD } from './hook/setting.js';
|
||||
// TODO: 更加规范
|
||||
export { clientMap } from './mcp/connect.service';
|
||||
export { clientMap } from './mcp/connect.service.js';
|
@ -1,8 +1,9 @@
|
||||
import { Controller, RequestClientType } from "../common";
|
||||
import { RequestData } from "../common/index.dto";
|
||||
import { PostMessageble } from "../hook/adapter";
|
||||
import { getClient } from "../mcp/connect.service";
|
||||
import { abortMessageService, streamingChatCompletion } from "./llm.service";
|
||||
import { RequestClientType } from "../common/index.dto.js";
|
||||
import { Controller } from "../common/index.js";
|
||||
import { RequestData } from "../common/index.dto.js";
|
||||
import { PostMessageble } from "../hook/adapter.js";
|
||||
import { getClient } from "../mcp/connect.service.js";
|
||||
import { abortMessageService, streamingChatCompletion } from "./llm.service.js";
|
||||
|
||||
export class LlmController {
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { PostMessageble } from "../hook/adapter";
|
||||
import { PostMessageble } from "../hook/adapter.js";
|
||||
import { OpenAI } from "openai";
|
||||
import { MyMessageType, MyToolMessageType } from "./llm.dto";
|
||||
import { RestfulResponse } from "../common/index.dto";
|
||||
import { ocrDB } from "../hook/db";
|
||||
import type { ToolCallContent } from "../mcp/client.dto";
|
||||
import { ocrWorkerStorage } from "../mcp/ocr.service";
|
||||
import { MyMessageType, MyToolMessageType } from "./llm.dto.js";
|
||||
import { RestfulResponse } from "../common/index.dto.js";
|
||||
import { ocrDB } from "../hook/db.js";
|
||||
import type { ToolCallContent } from "../mcp/client.dto.js";
|
||||
import { ocrWorkerStorage } from "../mcp/ocr.service.js";
|
||||
|
||||
export let currentStream: AsyncIterable<any> | null = null;
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { Controller } from "../common";
|
||||
import { RequestData } from "../common/index.dto";
|
||||
import { PostMessageble } from "../hook/adapter";
|
||||
import { postProcessMcpToolcallResponse } from "./client.service";
|
||||
import { getClient } from "./connect.service";
|
||||
import { Controller } from "../common/index.js";
|
||||
import { RequestData } from "../common/index.dto.js";
|
||||
import { PostMessageble } from "../hook/adapter.js";
|
||||
import { postProcessMcpToolcallResponse } from "./client.service.js";
|
||||
import { getClient } from "./connect.service.js";
|
||||
|
||||
export class ClientController {
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
|
||||
import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
|
||||
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
||||
import { Implementation } from "@modelcontextprotocol/sdk/types";
|
||||
import { Implementation } from "@modelcontextprotocol/sdk/types.js";
|
||||
|
||||
export interface GetPromptOption {
|
||||
promptId: string;
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Controller } from '../common';
|
||||
import { PostMessageble } from '../hook/adapter';
|
||||
import { RequestData } from '../common/index.dto';
|
||||
import { connectService, getClient } from './connect.service';
|
||||
import { Controller } from '../common/index.js';
|
||||
import { PostMessageble } from '../hook/adapter.js';
|
||||
import { RequestData } from '../common/index.dto.js';
|
||||
import { connectService, getClient } from './connect.service.js';
|
||||
|
||||
export class ConnectController {
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
import { exec, execSync, spawnSync } from 'node:child_process';
|
||||
import { RequestClientType } from '../common';
|
||||
import { connect } from './client.service';
|
||||
import { RestfulResponse } from '../common/index.dto';
|
||||
import { McpOptions } from './client.dto';
|
||||
import { RequestClientType } from '../common/index.dto.js';
|
||||
import { connect } from './client.service.js';
|
||||
import { RestfulResponse } from '../common/index.dto.js';
|
||||
import { McpOptions } from './client.dto.js';
|
||||
import * as crypto from 'node:crypto';
|
||||
import path from 'node:path';
|
||||
import fs from 'node:fs';
|
||||
import * as os from 'os';
|
||||
import { PostMessageble } from '../hook/adapter';
|
||||
import { PostMessageble } from '../hook/adapter.js';
|
||||
|
||||
export const clientMap: Map<string, RequestClientType> = new Map();
|
||||
export function getClient(clientId?: string): RequestClientType | undefined {
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { Controller, RequestClientType } from "../common";
|
||||
import { PostMessageble } from "../hook/adapter";
|
||||
import { diskStorage } from "../hook/db";
|
||||
import { createOcrWorker, saveBase64ImageData } from "./ocr.service";
|
||||
import { RequestClientType } from "../common/index.dto.js";
|
||||
import { Controller } from "../common/index.js";
|
||||
import { PostMessageble } from "../hook/adapter.js";
|
||||
import { diskStorage } from "../hook/db.js";
|
||||
import { createOcrWorker, saveBase64ImageData } from "./ocr.service.js";
|
||||
|
||||
export class OcrController {
|
||||
@Controller('ocr/get-ocr-image')
|
||||
|
@ -1,12 +1,12 @@
|
||||
import Tesseract from 'tesseract.js';
|
||||
import { PostMessageble } from '../hook/adapter';
|
||||
import { PostMessageble } from '../hook/adapter.js';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { OcrWorker } from './ocr.dto';
|
||||
import { diskStorage, ocrDB } from '../hook/db';
|
||||
import { OcrWorker } from './ocr.dto.js';
|
||||
import { diskStorage, ocrDB } from '../hook/db.js';
|
||||
import * as fs from 'fs';
|
||||
import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
import { RUNNING_CWD } from '../hook/setting';
|
||||
import { RUNNING_CWD } from '../hook/setting.js';
|
||||
|
||||
export const ocrWorkerStorage = new Map<string, OcrWorker>();
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { Controller } from "../common";
|
||||
import { PostMessageble } from "../hook/adapter";
|
||||
import { RequestData } from "../common/index.dto";
|
||||
import { getClient } from "../mcp/connect.service";
|
||||
import { systemPromptDB } from "../hook/db";
|
||||
import { loadTabSaveConfig, saveTabSaveConfig } from "./panel.service";
|
||||
import { Controller } from "../common/index.js";
|
||||
import { PostMessageble } from "../hook/adapter.js";
|
||||
import { RequestData } from "../common/index.dto.js";
|
||||
import { getClient } from "../mcp/connect.service.js";
|
||||
import { systemPromptDB } from "../hook/db.js";
|
||||
import { loadTabSaveConfig, saveTabSaveConfig } from "./panel.service.js";
|
||||
|
||||
export class PanelController {
|
||||
@Controller('panel/save')
|
||||
|
@ -1,9 +1,9 @@
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import { VSCODE_WORKSPACE } from '../hook/setting';
|
||||
import { IServerVersion } from '../mcp/client.dto';
|
||||
import { SaveTab } from './panel.dto';
|
||||
import { IConfig } from '../setting/setting.dto';
|
||||
import { VSCODE_WORKSPACE } from '../hook/setting.js';
|
||||
import { IServerVersion } from '../mcp/client.dto.js';
|
||||
import { SaveTab } from './panel.dto.js';
|
||||
import { IConfig } from '../setting/setting.dto.js';
|
||||
|
||||
const DEFAULT_TABS: SaveTab = {
|
||||
tabs: [],
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { WebSocketServer } from 'ws';
|
||||
import pino from 'pino';
|
||||
|
||||
import { routeMessage } from './common/router';
|
||||
import { VSCodeWebViewLike } from './hook/adapter';
|
||||
import { routeMessage } from './common/router.js';
|
||||
import { VSCodeWebViewLike } from './hook/adapter.js';
|
||||
import path from 'node:path';
|
||||
import * as fs from 'node:fs';
|
||||
import { setRunningCWD } from './hook/setting';
|
||||
import { setRunningCWD } from './hook/setting.js';
|
||||
import { exit } from 'node:process';
|
||||
|
||||
export interface VSCodeMessage {
|
||||
@ -14,7 +14,7 @@ export interface VSCodeMessage {
|
||||
callbackId?: string;
|
||||
}
|
||||
|
||||
const logger = pino({
|
||||
const logger = pino.default({
|
||||
transport: {
|
||||
target: 'pino-pretty', // 启用 pino-pretty
|
||||
options: {
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { Controller } from "../common";
|
||||
import { PostMessageble } from "../hook/adapter";
|
||||
import { RequestData } from "../common/index.dto";
|
||||
import { getClient } from "../mcp/connect.service";
|
||||
import { getTour, loadSetting, saveSetting, setTour } from "./setting.service";
|
||||
import { Controller } from "../common/index.js";
|
||||
import { PostMessageble } from "../hook/adapter.js";
|
||||
import { RequestData } from "../common/index.dto.js";
|
||||
import { getClient } from "../mcp/connect.service.js";
|
||||
import { getTour, loadSetting, saveSetting, setTour } from "./setting.service.js";
|
||||
|
||||
export class SettingController {
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
import * as fs from 'fs';
|
||||
import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
import { VSCODE_WORKSPACE } from '../hook/setting';
|
||||
import { IConfig } from './setting.dto';
|
||||
import { llms } from '../hook/llm';
|
||||
import { VSCODE_WORKSPACE } from '../hook/setting.js';
|
||||
import { IConfig } from './setting.dto.js';
|
||||
import { llms } from '../hook/llm.js';
|
||||
|
||||
function getConfigurationPath() {
|
||||
const homeDir = os.homedir();
|
||||
|
Loading…
x
Reference in New Issue
Block a user