chore: 项目环境升级为 JDK25,Spring 4.1,项目重构为多模块
This commit is contained in:
@@ -6,12 +6,12 @@ COPY --from=node /usr/local /usr/local
|
||||
|
||||
ENV JAVA_HOME=/opt/java/openjdk \
|
||||
PATH=/opt/java/openjdk/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin \
|
||||
NODE_PATH=/opt/agent-runtime/node_modules \
|
||||
PLAYWRIGHT_BROWSERS_PATH=/opt/agent-runtime/ms-playwright \
|
||||
NODE_PATH=/opt/sandbox/node_modules \
|
||||
PLAYWRIGHT_BROWSERS_PATH=/opt/sandbox/ms-playwright \
|
||||
PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1
|
||||
|
||||
WORKDIR /opt/agent-runtime
|
||||
WORKDIR /opt/sandbox
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci --omit=dev \
|
||||
&& pip install --no-cache-dir \
|
||||
@@ -34,7 +34,7 @@ RUN ln -s /opt/java/openjdk/bin/java /usr/local/bin/java \
|
||||
COPY fonts-local.conf /etc/fonts/local.conf
|
||||
RUN fc-cache -f
|
||||
|
||||
COPY --chown=agent:agent document_view.py ./
|
||||
COPY --chown=agent:agent document_view.py docx-example.cjs ./
|
||||
USER agent
|
||||
WORKDIR /workspace
|
||||
|
||||
|
||||
30
sandbox/docx-example.cjs
Normal file
30
sandbox/docx-example.cjs
Normal file
@@ -0,0 +1,30 @@
|
||||
// 使用 Runtime 实际安装的 docx API;可作为表格与原生批注的最小验证脚本。
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const assert = require('node:assert/strict');
|
||||
const { Document, Paragraph, TextRun, Table, TableRow, TableCell, Packer,
|
||||
CommentRangeStart, CommentRangeEnd, CommentReference } = require('docx');
|
||||
|
||||
async function main() {
|
||||
const output = process.argv[2];
|
||||
assert(output, '用法:node docx-example.cjs <输出.docx>');
|
||||
const document = new Document({
|
||||
comments: { children: [{ id: 0, author: '材料评审', date: new Date(),
|
||||
children: [new Paragraph({ children: [new TextRun('请企业确认设备数量。')] })] }] },
|
||||
sections: [{ children: [
|
||||
new Paragraph({ children: [
|
||||
new CommentRangeStart(0), new TextRun('待企业提供设备数量。'),
|
||||
new CommentRangeEnd(0), new TextRun({ children: [new CommentReference(0)] })
|
||||
] }),
|
||||
new Table({ rows: [new TableRow({ children: ['项目', '待确认'].map(text =>
|
||||
new TableCell({ children: [new Paragraph({ children: [new TextRun(text)] })] })) })] })
|
||||
] }]
|
||||
});
|
||||
const buffer = await Packer.toBuffer(document);
|
||||
assert.equal(buffer.subarray(0, 2).toString(), 'PK');
|
||||
fs.mkdirSync(path.dirname(output), { recursive: true });
|
||||
fs.writeFileSync(output, buffer);
|
||||
console.log(`DOCX API 验证通过:${buffer.length} 字节`);
|
||||
}
|
||||
|
||||
main().catch(error => { console.error(error); process.exitCode = 1; });
|
||||
4
sandbox/package-lock.json
generated
4
sandbox/package-lock.json
generated
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "smart-factory-agent-runtime",
|
||||
"name": "agent-sandbox",
|
||||
"version": "0.1.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "smart-factory-agent-runtime",
|
||||
"name": "agent-sandbox",
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"docx": "^9.5.1",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "smart-factory-agent-runtime",
|
||||
"name": "agent-sandbox",
|
||||
"private": true,
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
|
||||
Reference in New Issue
Block a user