Add the following TODOs
This commit is contained in:
parent
7551a55ce6
commit
f421bcae56
@ -31,6 +31,7 @@ async function getFullText(activeEditor: vscode.TextEditor): Promise<string> {
|
|||||||
return document.getText();
|
return document.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: 这里还有用吗?如果没用,就把这里以及相关代码删除;如果有用就用DevChatClient替换这里对DevChat的使用
|
||||||
async function getUndefinedSymbols(content: string): Promise<string[] | undefined> {
|
async function getUndefinedSymbols(content: string): Promise<string[] | undefined> {
|
||||||
// run devchat prompt command
|
// run devchat prompt command
|
||||||
const devChat = new DevChat();
|
const devChat = new DevChat();
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
|
||||||
|
// TODO: 确认所有DevChat()实例被替换后(contextRefDefs.js里),删除此文件
|
||||||
|
|
||||||
import * as dotenv from 'dotenv';
|
import * as dotenv from 'dotenv';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
|
@ -107,6 +107,11 @@ export async function buildRoleContextsFromFiles(
|
|||||||
return contexts;
|
return contexts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: 在插件启动为每个vscode窗口启动一个devchat local service
|
||||||
|
// 1. 分配单独的端口号,该窗口的所有请求都通过该端口号发送 (22222仅为作为开发默认端口号,不应用于生产)
|
||||||
|
// 2. 启动local service时要配置多个worker,以便处理并发请求
|
||||||
|
// TODO: 在插件关闭时,关闭其对应的devchat local service
|
||||||
|
|
||||||
export class DevChatClient {
|
export class DevChatClient {
|
||||||
private baseURL: string;
|
private baseURL: string;
|
||||||
|
|
||||||
@ -114,6 +119,10 @@ export class DevChatClient {
|
|||||||
|
|
||||||
static readonly logRawDataSizeLimit = 10; //4 * 1024;
|
static readonly logRawDataSizeLimit = 10; //4 * 1024;
|
||||||
|
|
||||||
|
// TODO: init devchat client with a port number
|
||||||
|
// TODO: the default 22222 is for dev only, should not be used in production
|
||||||
|
constructor(port: number = 22222) {
|
||||||
|
this.baseURL = `http://localhost:${port}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
async _get(path: string): Promise<AxiosResponse> {
|
async _get(path: string): Promise<AxiosResponse> {
|
||||||
@ -217,33 +226,21 @@ export class DevChatClient {
|
|||||||
chatRes.date = chunkData["date"];
|
chatRes.date = chunkData["date"];
|
||||||
}
|
}
|
||||||
chatRes.finish_reason = chunkData["finish_reason"];
|
chatRes.finish_reason = chunkData["finish_reason"];
|
||||||
// TODO: tmp string literal 临时字面量
|
|
||||||
if (chatRes.finish_reason === "should_run_workflow") {
|
if (chatRes.finish_reason === "should_run_workflow") {
|
||||||
chatRes.extra = chunkData["extra"];
|
chatRes.extra = chunkData["extra"];
|
||||||
logger
|
logger
|
||||||
.channel()
|
.channel()
|
||||||
?.debug(
|
?.debug("should run workflow via cli.");
|
||||||
"res on data: should_run_workflow. do nothing now."
|
|
||||||
);
|
|
||||||
logger
|
|
||||||
.channel()
|
|
||||||
?.debug(
|
|
||||||
`chatRes.extra: ${JSON.stringify(
|
|
||||||
chatRes.extra
|
|
||||||
)}`
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
chatRes.isError = chunkData["isError"];
|
chatRes.isError = chunkData["isError"];
|
||||||
|
|
||||||
chatRes.response += chunkData["content"];
|
chatRes.response += chunkData["content"];
|
||||||
logger.channel()?.debug(`${chunkData["content"]}`);
|
|
||||||
onData(chatRes);
|
onData(chatRes);
|
||||||
});
|
});
|
||||||
|
|
||||||
response.data.on("end", () => {
|
response.data.on("end", () => {
|
||||||
logger.channel()?.debug("\nStreaming ended");
|
|
||||||
resolve(chatRes); // Resolve the promise with chatRes when the stream ends
|
resolve(chatRes); // Resolve the promise with chatRes when the stream ends
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -403,7 +400,9 @@ export class DevChatClient {
|
|||||||
|
|
||||||
logger
|
logger
|
||||||
.channel()
|
.channel()
|
||||||
?.debug(`deleteTopic response data: ${JSON.stringify(response.data)}`);
|
?.debug(
|
||||||
|
`deleteTopic response data: ${JSON.stringify(response.data)}`
|
||||||
|
);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,8 @@ import { CommandRun } from '../../src/util/commonUtil';
|
|||||||
import { UiUtilWrapper } from '../../src/util/uiUtil';
|
import { UiUtilWrapper } from '../../src/util/uiUtil';
|
||||||
import { ApiKeyManager } from '../../src/util/apiKey';
|
import { ApiKeyManager } from '../../src/util/apiKey';
|
||||||
|
|
||||||
|
// TODO: 删除devchat.js时,删除此测试文件
|
||||||
|
// TODO: 同时为 DevChatCLI & DevChatClient 添加测试
|
||||||
describe('DevChat', () => {
|
describe('DevChat', () => {
|
||||||
let devChat: DevChat;
|
let devChat: DevChat;
|
||||||
let spawnAsyncStub: sinon.SinonStub;
|
let spawnAsyncStub: sinon.SinonStub;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user