bailian-cli-core 1.2.1 → 1.3.0
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/dist/index.d.mts +32 -2
- package/dist/index.mjs +9 -3
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -421,7 +421,11 @@ interface KnowledgeRetrieveRequest {
|
|
|
421
421
|
EnableRewrite?: boolean;
|
|
422
422
|
RerankTopN?: number;
|
|
423
423
|
TopK?: number;
|
|
424
|
-
Rerank?:
|
|
424
|
+
Rerank?: Array<{
|
|
425
|
+
ModelName?: string;
|
|
426
|
+
RerankMode?: string;
|
|
427
|
+
RerankInstruct?: string;
|
|
428
|
+
}>;
|
|
425
429
|
RerankTopN_legacy?: number;
|
|
426
430
|
SearchFilters?: Array<{
|
|
427
431
|
Key: string;
|
|
@@ -440,6 +444,31 @@ interface KnowledgeRetrieveResponse {
|
|
|
440
444
|
}>;
|
|
441
445
|
};
|
|
442
446
|
}
|
|
447
|
+
interface DashScopeKnowledgeRetrieveRequest {
|
|
448
|
+
index_id: string;
|
|
449
|
+
query: string;
|
|
450
|
+
search_filters?: Array<Record<string, unknown>>;
|
|
451
|
+
dense_similarity_top_k?: number;
|
|
452
|
+
sparse_similarity_top_k?: number;
|
|
453
|
+
enable_reranking?: boolean;
|
|
454
|
+
rerank_top_n?: number;
|
|
455
|
+
rerank?: Array<{
|
|
456
|
+
model_name: string;
|
|
457
|
+
rerank_mode?: string;
|
|
458
|
+
rerank_instruct?: string;
|
|
459
|
+
}>;
|
|
460
|
+
}
|
|
461
|
+
interface DashScopeKnowledgeRetrieveResponse {
|
|
462
|
+
request_id: string;
|
|
463
|
+
data: {
|
|
464
|
+
total: number;
|
|
465
|
+
nodes: Array<{
|
|
466
|
+
text: string;
|
|
467
|
+
score: number;
|
|
468
|
+
metadata: Record<string, unknown>;
|
|
469
|
+
}>;
|
|
470
|
+
};
|
|
471
|
+
}
|
|
443
472
|
interface DashScopeTTSRequest {
|
|
444
473
|
model: string;
|
|
445
474
|
input: {
|
|
@@ -682,6 +711,7 @@ declare function speechSynthesizeEndpoint(baseUrl: string): string;
|
|
|
682
711
|
declare function speechRecognizeEndpoint(baseUrl: string): string;
|
|
683
712
|
declare function profileSchemaEndpoint(baseUrl: string): string;
|
|
684
713
|
declare function userProfileEndpoint(baseUrl: string, schemaId: string): string;
|
|
714
|
+
declare function knowledgeRetrieveEndpoint(baseUrl: string): string;
|
|
685
715
|
declare function mcpWebSearchEndpoint(baseUrl: string): string;
|
|
686
716
|
//#endregion
|
|
687
717
|
//#region src/client/headers.d.ts
|
|
@@ -1205,4 +1235,4 @@ interface ModelSource {
|
|
|
1205
1235
|
load(): Promise<ModelProfile[]>;
|
|
1206
1236
|
}
|
|
1207
1237
|
//#endregion
|
|
1208
|
-
export { AkSignConfig, type ApiErrorBody, AppCompletionRequest, AppCompletionResponse, AppStreamChunk, AuthMethod, BAILIAN_HOST, BailianError, Budget, Budgets, CHANNEL, CONSOLE_GATEWAY_NO_TOKEN_MESSAGE, Capabilities, Capability, ChatChoice, ChatMessage, ChatMessageContent, ChatRequest, ChatResponse, ChatTool, Command, CommandSpec, Complexities, Complexity, Config, ConfigFile, ConsoleGatewayRequest, ContextNeed, ContextNeeds, DOCS_HOSTS, DashScopeASRRequest, DashScopeASRTaskResult, DashScopeAsyncResponse, DashScopeImageRequest, DashScopeImageSyncResponse, DashScopeTTSRequest, DashScopeTTSResponse, DashScopeTTSStreamChunk, DashScopeTaskResponse, DashScopeVideoEditRequest, DashScopeVideoRefRequest, DashScopeVideoRequest, ExitCode, Feature, Features, GLOBAL_OPTIONS, GetModelsOptions, GlobalFlags, IntentProfile, IntentSegment, KnowledgeRetrieveRequest, KnowledgeRetrieveResponse, McpClient, McpTool, McpToolResult, MemoryAddRequest, MemoryAddResponse, MemoryMessage, MemoryNode, MemoryNodeListResponse, MemoryNodeUpdateRequest, MemorySearchRequest, MemorySearchResponse, Modalities, Modality, ModelCategories, ModelCategory, ModelListParams, ModelListResult, ModelPreference, ModelPrice, ModelProfile, ModelSource, OptionDef, OutputFormat, PipelineResult, PipelineStep, PreferenceMode, ProfileAttribute, ProfileSchemaCreateRequest, ProfileSchemaCreateResponse, QpmLimit, QualityPreference, QualityPreferences, REGIONS, RecommendOptions, RecommendResult, RecommendedModel, Region, RequestOpts, ResolvedCredential, SOURCE_CONFIG, ScoredCandidate, ServerSentEvent, SingleResult, StreamChoice, StreamChunk, TAGS, TrackingEvent, UserProfileResponse, analyzeIntent, appCompletionEndpoint, bailianMcpUrl, buildDocLink, callConsoleGateway, chatEndpoint, clearApiKey, createTrackingEvent, defineCommand, detectOutputFormat, ensureConfigDir, fetchModelList, flushTelemetry, formatErrorJson, formatJson, formatOutput, formatText, generateFilename, generateToolSchema, getConfigDir, getConfigPath, getCredentialsPath, getModels, imageEndpoint, imageSyncEndpoint, isCI, isInteractive, isLocalFile, isSemanticAvailable, loadApiKeyFromConfig, loadConfig, localSink, mapApiError, maskToken, mcpWebSearchEndpoint, memoryAddEndpoint, memoryListEndpoint, memoryNodeEndpoint, memorySearchEndpoint, parseBooleanValue, parseConfigFile, parseOptionalBooleanValue, parseSSE, profileSchemaEndpoint, rankModels, readConfigFile, recallCandidates, recallSemantic, remoteSink, request, requestJson, resolveBooleanFlag, resolveConsoleGatewayCredential, resolveCredential, resolveFileUrl, resolveOutputDir, resolveWatermark, saveApiKeyToConfig, signRequest, speechRecognizeEndpoint, speechSynthesizeEndpoint, stripUndefined, taskEndpoint, trackCommandExecution, trackingHeaders, uploadFile, userProfileEndpoint, videoGenerateEndpoint, writeConfigFile };
|
|
1238
|
+
export { AkSignConfig, type ApiErrorBody, AppCompletionRequest, AppCompletionResponse, AppStreamChunk, AuthMethod, BAILIAN_HOST, BailianError, Budget, Budgets, CHANNEL, CONSOLE_GATEWAY_NO_TOKEN_MESSAGE, Capabilities, Capability, ChatChoice, ChatMessage, ChatMessageContent, ChatRequest, ChatResponse, ChatTool, Command, CommandSpec, Complexities, Complexity, Config, ConfigFile, ConsoleGatewayRequest, ContextNeed, ContextNeeds, DOCS_HOSTS, DashScopeASRRequest, DashScopeASRTaskResult, DashScopeAsyncResponse, DashScopeImageRequest, DashScopeImageSyncResponse, DashScopeKnowledgeRetrieveRequest, DashScopeKnowledgeRetrieveResponse, DashScopeTTSRequest, DashScopeTTSResponse, DashScopeTTSStreamChunk, DashScopeTaskResponse, DashScopeVideoEditRequest, DashScopeVideoRefRequest, DashScopeVideoRequest, ExitCode, Feature, Features, GLOBAL_OPTIONS, GetModelsOptions, GlobalFlags, IntentProfile, IntentSegment, KnowledgeRetrieveRequest, KnowledgeRetrieveResponse, McpClient, McpTool, McpToolResult, MemoryAddRequest, MemoryAddResponse, MemoryMessage, MemoryNode, MemoryNodeListResponse, MemoryNodeUpdateRequest, MemorySearchRequest, MemorySearchResponse, Modalities, Modality, ModelCategories, ModelCategory, ModelListParams, ModelListResult, ModelPreference, ModelPrice, ModelProfile, ModelSource, OptionDef, OutputFormat, PipelineResult, PipelineStep, PreferenceMode, ProfileAttribute, ProfileSchemaCreateRequest, ProfileSchemaCreateResponse, QpmLimit, QualityPreference, QualityPreferences, REGIONS, RecommendOptions, RecommendResult, RecommendedModel, Region, RequestOpts, ResolvedCredential, SOURCE_CONFIG, ScoredCandidate, ServerSentEvent, SingleResult, StreamChoice, StreamChunk, TAGS, TrackingEvent, UserProfileResponse, analyzeIntent, appCompletionEndpoint, bailianMcpUrl, buildDocLink, callConsoleGateway, chatEndpoint, clearApiKey, createTrackingEvent, defineCommand, detectOutputFormat, ensureConfigDir, fetchModelList, flushTelemetry, formatErrorJson, formatJson, formatOutput, formatText, generateFilename, generateToolSchema, getConfigDir, getConfigPath, getCredentialsPath, getModels, imageEndpoint, imageSyncEndpoint, isCI, isInteractive, isLocalFile, isSemanticAvailable, knowledgeRetrieveEndpoint, loadApiKeyFromConfig, loadConfig, localSink, mapApiError, maskToken, mcpWebSearchEndpoint, memoryAddEndpoint, memoryListEndpoint, memoryNodeEndpoint, memorySearchEndpoint, parseBooleanValue, parseConfigFile, parseOptionalBooleanValue, parseSSE, profileSchemaEndpoint, rankModels, readConfigFile, recallCandidates, recallSemantic, remoteSink, request, requestJson, resolveBooleanFlag, resolveConsoleGatewayCredential, resolveCredential, resolveFileUrl, resolveOutputDir, resolveWatermark, saveApiKeyToConfig, signRequest, speechRecognizeEndpoint, speechSynthesizeEndpoint, stripUndefined, taskEndpoint, trackCommandExecution, trackingHeaders, uploadFile, userProfileEndpoint, videoGenerateEndpoint, writeConfigFile };
|
package/dist/index.mjs
CHANGED
|
@@ -261,7 +261,7 @@ function loadConfig(flags) {
|
|
|
261
261
|
accessKeyId: process.env.ALIBABA_CLOUD_ACCESS_KEY_ID || file.access_key_id || void 0,
|
|
262
262
|
accessKeySecret: process.env.ALIBABA_CLOUD_ACCESS_KEY_SECRET || file.access_key_secret || void 0,
|
|
263
263
|
workspaceId: process.env.BAILIAN_WORKSPACE_ID || file.workspace_id || void 0,
|
|
264
|
-
consoleGatewayUrl: process.env.BAILIAN_CONSOLE_GATEWAY_URL || file.console_gateway_url || "https://
|
|
264
|
+
consoleGatewayUrl: process.env.BAILIAN_CONSOLE_GATEWAY_URL || file.console_gateway_url || "https://bailian-cs.console.aliyun.com",
|
|
265
265
|
verbose: flags.verbose || process.env.DASHSCOPE_VERBOSE === "1",
|
|
266
266
|
quiet: flags.quiet || false,
|
|
267
267
|
noColor: flags.noColor || process.env.NO_COLOR !== void 0 || !process.stdout.isTTY,
|
|
@@ -451,6 +451,9 @@ function profileSchemaEndpoint(baseUrl) {
|
|
|
451
451
|
function userProfileEndpoint(baseUrl, schemaId) {
|
|
452
452
|
return `${baseUrl}/api/v2/apps/memory/profile_schemas/${encodeURIComponent(schemaId)}/profiles`;
|
|
453
453
|
}
|
|
454
|
+
function knowledgeRetrieveEndpoint(baseUrl) {
|
|
455
|
+
return `${baseUrl}/api/v1/indices/rag/index/retrieve`;
|
|
456
|
+
}
|
|
454
457
|
function mcpWebSearchEndpoint(baseUrl) {
|
|
455
458
|
return `${baseUrl}/api/v1/mcps/WebSearch/mcp`;
|
|
456
459
|
}
|
|
@@ -766,7 +769,10 @@ async function callConsoleGateway(config, token, { api, data, region = "cn-beiji
|
|
|
766
769
|
const t = await res.text().catch(() => "");
|
|
767
770
|
throw new BailianError(`Console CLI gateway failed: HTTP ${res.status} ${res.statusText}`, ExitCode.GENERAL, t.slice(0, 500));
|
|
768
771
|
}
|
|
769
|
-
|
|
772
|
+
const json = await res.json();
|
|
773
|
+
const innerData = json.data;
|
|
774
|
+
if (innerData?.success === false && innerData.errorCode) throw new BailianError(`Console gateway error: ${innerData.errorCode}`, ExitCode.GENERAL, typeof innerData.errorMsg === "string" ? innerData.errorMsg : void 0);
|
|
775
|
+
return json;
|
|
770
776
|
}
|
|
771
777
|
//#endregion
|
|
772
778
|
//#region src/console/models.ts
|
|
@@ -3310,4 +3316,4 @@ async function rankModels(config, candidates, intent, userInput, top, options) {
|
|
|
3310
3316
|
};
|
|
3311
3317
|
}
|
|
3312
3318
|
//#endregion
|
|
3313
|
-
export { BAILIAN_HOST, BailianError, Budgets, CHANNEL, CONSOLE_GATEWAY_NO_TOKEN_MESSAGE, Capabilities, Complexities, ContextNeeds, DOCS_HOSTS, ExitCode, Features, GLOBAL_OPTIONS, McpClient, Modalities, ModelCategories, QualityPreferences, REGIONS, SOURCE_CONFIG, TAGS, analyzeIntent, appCompletionEndpoint, bailianMcpUrl, buildDocLink, callConsoleGateway, chatEndpoint, clearApiKey, createTrackingEvent, defineCommand, detectOutputFormat, ensureConfigDir, fetchModelList, flushTelemetry, formatErrorJson, formatJson, formatOutput, formatText, generateFilename, generateToolSchema, getConfigDir, getConfigPath, getCredentialsPath, getModels, imageEndpoint, imageSyncEndpoint, isCI, isInteractive, isLocalFile, isSemanticAvailable, loadApiKeyFromConfig, loadConfig, localSink, mapApiError, maskToken, mcpWebSearchEndpoint, memoryAddEndpoint, memoryListEndpoint, memoryNodeEndpoint, memorySearchEndpoint, parseBooleanValue, parseConfigFile, parseOptionalBooleanValue, parseSSE, profileSchemaEndpoint, rankModels, readConfigFile, recallCandidates, recallSemantic, remoteSink, request, requestJson, resolveBooleanFlag, resolveConsoleGatewayCredential, resolveCredential, resolveFileUrl, resolveOutputDir, resolveWatermark, saveApiKeyToConfig, signRequest, speechRecognizeEndpoint, speechSynthesizeEndpoint, stripUndefined, taskEndpoint, trackCommandExecution, trackingHeaders, uploadFile, userProfileEndpoint, videoGenerateEndpoint, writeConfigFile };
|
|
3319
|
+
export { BAILIAN_HOST, BailianError, Budgets, CHANNEL, CONSOLE_GATEWAY_NO_TOKEN_MESSAGE, Capabilities, Complexities, ContextNeeds, DOCS_HOSTS, ExitCode, Features, GLOBAL_OPTIONS, McpClient, Modalities, ModelCategories, QualityPreferences, REGIONS, SOURCE_CONFIG, TAGS, analyzeIntent, appCompletionEndpoint, bailianMcpUrl, buildDocLink, callConsoleGateway, chatEndpoint, clearApiKey, createTrackingEvent, defineCommand, detectOutputFormat, ensureConfigDir, fetchModelList, flushTelemetry, formatErrorJson, formatJson, formatOutput, formatText, generateFilename, generateToolSchema, getConfigDir, getConfigPath, getCredentialsPath, getModels, imageEndpoint, imageSyncEndpoint, isCI, isInteractive, isLocalFile, isSemanticAvailable, knowledgeRetrieveEndpoint, loadApiKeyFromConfig, loadConfig, localSink, mapApiError, maskToken, mcpWebSearchEndpoint, memoryAddEndpoint, memoryListEndpoint, memoryNodeEndpoint, memorySearchEndpoint, parseBooleanValue, parseConfigFile, parseOptionalBooleanValue, parseSSE, profileSchemaEndpoint, rankModels, readConfigFile, recallCandidates, recallSemantic, remoteSink, request, requestJson, resolveBooleanFlag, resolveConsoleGatewayCredential, resolveCredential, resolveFileUrl, resolveOutputDir, resolveWatermark, saveApiKeyToConfig, signRequest, speechRecognizeEndpoint, speechSynthesizeEndpoint, stripUndefined, taskEndpoint, trackCommandExecution, trackingHeaders, uploadFile, userProfileEndpoint, videoGenerateEndpoint, writeConfigFile };
|
package/package.json
CHANGED