演示目录只保留可重建的源码。运行密钥、数据卷、依赖和带口令的本地配置不进入仓库。 Co-authored-by: Cursor <cursoragent@cursor.com>
36 lines
872 B
TypeScript
36 lines
872 B
TypeScript
import { consoleClient } from '@/service/console'
|
|
|
|
type LogicalDocumentCitation = {
|
|
documentId: string
|
|
revision: number
|
|
}
|
|
|
|
export async function resolveLogicalDocumentCitation({
|
|
documentAssetId,
|
|
documentVersion,
|
|
knowledgeSpaceId,
|
|
}: {
|
|
documentAssetId: string
|
|
documentVersion?: number
|
|
knowledgeSpaceId: string
|
|
}): Promise<LogicalDocumentCitation | undefined> {
|
|
if (documentVersion === undefined) return undefined
|
|
|
|
const citation =
|
|
await consoleClient.knowledgeFs.spaces.byControlSpaceId.documentReferences.resolve.get(
|
|
{
|
|
params: { control_space_id: knowledgeSpaceId },
|
|
query: {
|
|
document_asset_id: documentAssetId,
|
|
document_asset_version: documentVersion,
|
|
},
|
|
},
|
|
{ context: { silent: true } },
|
|
)
|
|
|
|
return {
|
|
documentId: citation.document_id,
|
|
revision: citation.revision,
|
|
}
|
|
}
|