@comate/zulu 0.0.11 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +98 -0
- package/comate-engine/bin/comate.js +32 -1
- package/comate-engine/node_modules/@comate/plugin-engine/dist/index.js +15 -7
- package/comate-engine/node_modules/@comate/plugin-host/dist/index.js +1 -1
- package/comate-engine/node_modules/@comate/plugin-host/dist/main.js +1 -1
- package/comate-engine/node_modules/@comate/plugin-host/dist/{user-Btg63hPI.js → user-tNVx6ovK.js} +15 -7
- package/comate-engine/node_modules/@comate/plugin-shared-internals/dist/index.d.ts +63 -4
- package/comate-engine/node_modules/@comate/plugin-shared-internals/dist/index.js +15 -7
- package/comate-engine/node_modules/@comate/plugin-shared-internals/package.json +1 -0
- package/comate-engine/package.json +3 -0
- package/comate-engine/plugins/demo-feature/dist/index.js +17204 -0
- package/comate-engine/plugins/devaux/dist/index.js +203 -0
- package/comate-engine/plugins/f2c/dist/index.js +17204 -0
- package/comate-engine/plugins/xiaomi-aiot/dist/index.js +17204 -0
- package/comate-engine/server.js +17 -17
- package/dist/bundle/index.js +2 -2
- package/package.json +1 -1
|
@@ -49336,6 +49336,207 @@ class mrd2CodeProvider extends SkillProvider {
|
|
|
49336
49336
|
}
|
|
49337
49337
|
}
|
|
49338
49338
|
|
|
49339
|
+
class tangoProvider extends SkillProvider {
|
|
49340
|
+
static{
|
|
49341
|
+
this.skillName = 'tango';
|
|
49342
|
+
}
|
|
49343
|
+
static{
|
|
49344
|
+
this.displayName = 'tango';
|
|
49345
|
+
}
|
|
49346
|
+
static{
|
|
49347
|
+
this.description = 'tango';
|
|
49348
|
+
}
|
|
49349
|
+
static{
|
|
49350
|
+
this.parameters = {
|
|
49351
|
+
type: 'object',
|
|
49352
|
+
properties: {}
|
|
49353
|
+
};
|
|
49354
|
+
}
|
|
49355
|
+
constructor(init){
|
|
49356
|
+
super(init);
|
|
49357
|
+
this.git = new GitUtil(init.cwd);
|
|
49358
|
+
this.cwd = init.cwd;
|
|
49359
|
+
}
|
|
49360
|
+
// eslint-disable-next-line
|
|
49361
|
+
async *execute() {
|
|
49362
|
+
const stream = new ElementChunkStream();
|
|
49363
|
+
const user = await this.currentUser.requestDetail();
|
|
49364
|
+
const userName = user ? user.name : 'unknown';
|
|
49365
|
+
let isSuccess = false;
|
|
49366
|
+
// wbox平台注册本次扫描任务
|
|
49367
|
+
const wboxTaskId = await wboxRegister(user, 'tango', this.currentContext.query, this.git);
|
|
49368
|
+
try {
|
|
49369
|
+
const moduleName = await this.git.getModuleName(this.cwd);
|
|
49370
|
+
const kirinTaskID = await startKirinAsyncStrategy(kirinCodeModificationAsynURL, {
|
|
49371
|
+
parameter: JSON.stringify({
|
|
49372
|
+
requirement: 'tango_gen_main\n' + this.currentContext.query,
|
|
49373
|
+
// eslint-disable-next-line
|
|
49374
|
+
conf_file: '',
|
|
49375
|
+
conf: '',
|
|
49376
|
+
scene: 'tango_gen_main',
|
|
49377
|
+
// eslint-disable-next-line
|
|
49378
|
+
rd: userName,
|
|
49379
|
+
moduleName: await this.git.getModuleName()
|
|
49380
|
+
}),
|
|
49381
|
+
name: kirinUserName,
|
|
49382
|
+
token: kirinToken
|
|
49383
|
+
});
|
|
49384
|
+
if (!kirinTaskID) {
|
|
49385
|
+
const failMessage = renderTemplate(taskExecuteErrorInfo, {
|
|
49386
|
+
groupID: userServiceHiGroupNumber,
|
|
49387
|
+
taskID: kirinTaskID
|
|
49388
|
+
});
|
|
49389
|
+
yield stream.flushReplaceLast(/*#__PURE__*/ jsx("p", {
|
|
49390
|
+
children: failMessage + 'error: kirinTaskID is null'
|
|
49391
|
+
}));
|
|
49392
|
+
return;
|
|
49393
|
+
}
|
|
49394
|
+
const { status, kirinResponse, message } = await getKirinAsyncStrategyResult(kirinTaskID, 600 * 1000);
|
|
49395
|
+
if (status === FeedStrategyStatus.ERROR_STRATEGY_FAIL) {
|
|
49396
|
+
const failMessage = renderTemplate(taskExecuteErrorInfo, {
|
|
49397
|
+
groupID: userServiceHiGroupNumber,
|
|
49398
|
+
taskID: kirinTaskID
|
|
49399
|
+
});
|
|
49400
|
+
yield stream.flush(/*#__PURE__*/ jsx("p", {
|
|
49401
|
+
children: failMessage + 'fail reason:' + message
|
|
49402
|
+
}));
|
|
49403
|
+
return;
|
|
49404
|
+
} else if (status === FeedStrategyStatus.ERROR_TIMEOUT) {
|
|
49405
|
+
const failMessage = renderTemplate(taskExecuteTimeoutErroInfo, {
|
|
49406
|
+
groupID: userServiceHiGroupNumber,
|
|
49407
|
+
taskID: kirinTaskID
|
|
49408
|
+
});
|
|
49409
|
+
yield stream.flush(/*#__PURE__*/ jsx("p", {
|
|
49410
|
+
children: failMessage + 'timeout'
|
|
49411
|
+
}));
|
|
49412
|
+
return;
|
|
49413
|
+
}
|
|
49414
|
+
if (kirinResponse.length === 0) {
|
|
49415
|
+
const failMessage = renderTemplate(taskExecuteErrorInfo, {
|
|
49416
|
+
groupID: userServiceHiGroupNumber,
|
|
49417
|
+
taskID: kirinTaskID
|
|
49418
|
+
});
|
|
49419
|
+
yield stream.flushReplaceLast(/*#__PURE__*/ jsx("p", {
|
|
49420
|
+
children: failMessage + 'error: kirinResponse is empty'
|
|
49421
|
+
}));
|
|
49422
|
+
return;
|
|
49423
|
+
}
|
|
49424
|
+
let chunkStr = '';
|
|
49425
|
+
let result = [];
|
|
49426
|
+
// eslint-disable-next-line
|
|
49427
|
+
for (const [index, kirinRes] of kirinResponse.entries()){
|
|
49428
|
+
let singleChunkStr = '';
|
|
49429
|
+
let modelReader = null;
|
|
49430
|
+
const models = kirinRes.models;
|
|
49431
|
+
if (!models || !models.url) {
|
|
49432
|
+
if (kirinRes.add_before && kirinRes.add_before.length !== 0) {
|
|
49433
|
+
let { elemResult } = await parsePathLists(kirinRes.add_before, this.cwd, kirinRes.file_path);
|
|
49434
|
+
result = result.concat(elemResult);
|
|
49435
|
+
yield stream.flush(/*#__PURE__*/ jsx("markdown", {
|
|
49436
|
+
children: kirinRes.add_before
|
|
49437
|
+
}));
|
|
49438
|
+
}
|
|
49439
|
+
continue;
|
|
49440
|
+
} else if (models && (models.url.includes('deepseek') || models.url.includes('10.55.119.216') || models.url.includes('volces.com') || models.url.includes('aliyun') || models.url.includes('https://qianfan.baidubce.com/v2/chat/completions'))) {
|
|
49441
|
+
modelReader = await fetchStreamUrl(models.url, models.headers, models.data, models.method);
|
|
49442
|
+
} else if (models && models.url) {
|
|
49443
|
+
modelReader = await fetchStreamUrl(`${models.url}?access_token=${models.params.access_token}`, commonHeadersConfig, models.data, models.method);
|
|
49444
|
+
}
|
|
49445
|
+
if (!modelReader) {
|
|
49446
|
+
const failMessage = renderTemplate(taskExecuteErrorInfo, {
|
|
49447
|
+
groupID: userServiceHiGroupNumber,
|
|
49448
|
+
taskID: kirinTaskID
|
|
49449
|
+
});
|
|
49450
|
+
yield stream.flushReplaceLast(/*#__PURE__*/ jsx("p", {
|
|
49451
|
+
children: failMessage + 'error: modelReader is null'
|
|
49452
|
+
}));
|
|
49453
|
+
return;
|
|
49454
|
+
}
|
|
49455
|
+
if (kirinRes.add_before && kirinRes.add_before.length !== 0) {
|
|
49456
|
+
result.push(/*#__PURE__*/ jsx("markdown", {
|
|
49457
|
+
children: kirinRes.add_before
|
|
49458
|
+
}));
|
|
49459
|
+
yield stream.flush(/*#__PURE__*/ jsx("p", {
|
|
49460
|
+
children: kirinRes.add_before
|
|
49461
|
+
}));
|
|
49462
|
+
}
|
|
49463
|
+
try {
|
|
49464
|
+
let modelType = ModelType.WENXIN;
|
|
49465
|
+
if (models.url.includes('deepseek') || models.url.includes('10.55.119.216') || models.url.includes('volces.com') || models.url.includes('aliyun') || models.url.includes('https://qianfan.baidubce.com/v2/chat/completions')) {
|
|
49466
|
+
modelType = ModelType.DEEPSEEK;
|
|
49467
|
+
} else {
|
|
49468
|
+
modelType = ModelType.WENXIN;
|
|
49469
|
+
}
|
|
49470
|
+
let isFirstFlush = true;
|
|
49471
|
+
for await (const data of getReaderStr(modelReader, modelType)){
|
|
49472
|
+
if (data.message !== null) {
|
|
49473
|
+
chunkStr += data.message;
|
|
49474
|
+
singleChunkStr += data.message;
|
|
49475
|
+
}
|
|
49476
|
+
if (isFirstFlush) {
|
|
49477
|
+
yield stream.flush(/*#__PURE__*/ jsx("markdown", {
|
|
49478
|
+
children: singleChunkStr
|
|
49479
|
+
}));
|
|
49480
|
+
isFirstFlush = false;
|
|
49481
|
+
} else {
|
|
49482
|
+
yield stream.flushReplaceLast(/*#__PURE__*/ jsx("markdown", {
|
|
49483
|
+
children: singleChunkStr
|
|
49484
|
+
}));
|
|
49485
|
+
}
|
|
49486
|
+
}
|
|
49487
|
+
let { elemResult } = await parsePathLists(singleChunkStr, this.cwd, kirinRes.file_path);
|
|
49488
|
+
result = result.concat(elemResult);
|
|
49489
|
+
yield stream.flush(/*#__PURE__*/ jsx("br", {}));
|
|
49490
|
+
} catch (error) {
|
|
49491
|
+
const failMessage = renderTemplate(taskExecuteErrorInfo, {
|
|
49492
|
+
groupID: userServiceHiGroupNumber,
|
|
49493
|
+
taskID: kirinTaskID
|
|
49494
|
+
});
|
|
49495
|
+
// eslint-disable-next-line
|
|
49496
|
+
yield stream.flush(/*#__PURE__*/ jsx("p", {
|
|
49497
|
+
children: failMessage + ' error:' + error
|
|
49498
|
+
}));
|
|
49499
|
+
} finally{
|
|
49500
|
+
modelReader.releaseLock();
|
|
49501
|
+
await flushRes2Qadc([
|
|
49502
|
+
{
|
|
49503
|
+
kirin_id: kirinTaskID,
|
|
49504
|
+
order_id: `${kirinTaskID}_${index}`,
|
|
49505
|
+
model: JSON.stringify(kirinRes.models),
|
|
49506
|
+
add_before: kirinRes.add_before,
|
|
49507
|
+
add_after: kirinRes.add_after,
|
|
49508
|
+
result: singleChunkStr,
|
|
49509
|
+
rd_name: user ? user.name : 'unknown',
|
|
49510
|
+
module: moduleName
|
|
49511
|
+
}
|
|
49512
|
+
], 'code_gen_record');
|
|
49513
|
+
if (kirinRes.add_after && kirinRes.add_after.length !== 0) {
|
|
49514
|
+
result.push(/*#__PURE__*/ jsx("markdown", {
|
|
49515
|
+
children: kirinRes.add_after
|
|
49516
|
+
}));
|
|
49517
|
+
yield stream.flush(/*#__PURE__*/ jsx("markdown", {
|
|
49518
|
+
children: kirinRes.add_after
|
|
49519
|
+
}));
|
|
49520
|
+
}
|
|
49521
|
+
}
|
|
49522
|
+
}
|
|
49523
|
+
yield stream.flushReplaceAll(result);
|
|
49524
|
+
isSuccess = true;
|
|
49525
|
+
} // eslint-disable-next-line
|
|
49526
|
+
catch (e) {
|
|
49527
|
+
yield stream.flush(/*#__PURE__*/ jsx("p", {
|
|
49528
|
+
children: 'exception:' + e
|
|
49529
|
+
}));
|
|
49530
|
+
} finally{
|
|
49531
|
+
await wboxCallBack({
|
|
49532
|
+
taskId: wboxTaskId ? wboxTaskId : 0,
|
|
49533
|
+
status: isSuccess ? 2 : 1,
|
|
49534
|
+
caller: userName
|
|
49535
|
+
});
|
|
49536
|
+
}
|
|
49537
|
+
}
|
|
49538
|
+
}
|
|
49539
|
+
|
|
49339
49540
|
function mapToJson(mapObj) {
|
|
49340
49541
|
const obj = {};
|
|
49341
49542
|
for (let [k, v] of mapObj){
|
|
@@ -50481,6 +50682,8 @@ async function* getKirinSkillRecogRes(provider, extendsArgs, scene = 'fallback')
|
|
|
50481
50682
|
}
|
|
50482
50683
|
if (kirinResponse.providerOnly) {
|
|
50483
50684
|
switch(kirinResponse.provider){
|
|
50685
|
+
case 'tangoProvider':
|
|
50686
|
+
return new tangoProvider(provider);
|
|
50484
50687
|
case 'HarmonyGen':
|
|
50485
50688
|
return new HarmonyGen(provider);
|
|
50486
50689
|
case 'OPGeneratorProvider':
|