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