Tự động hoá việc dịch tài liệu bằng cách sử dụng các mô hình AI Google Gemini cùng Aspose.Words cho Node.js via .NET. Dịch các tệp DOC, DOCX, RTF, PDF, HTML, Markdown, ODT, TXT và EPUB sang hơn 300 ngôn ngữ đồng thời giữ nguyên bố cục và định dạng gốc. Động cơ dựa trên AI tự động phát hiện ngôn ngữ nguồn — ngay cả trong các tài liệu đa ngôn ngữ — và chỉ để lại chưa dịch những đoạn mà nó không thể nhận dạng.
Xác thực yêu cầu một khóa API của Google. Để xem danh sách đầy đủ các mô hình AI được hỗ trợ, xem Tài liệu tham khảo API.
Bắt đầu dịch tài liệu trong JavaScript ngay hôm nay — hãy thử bản demo trực tiếp ở trên.
npm install @aspose/words
Sao chép
const aw = require('@aspose/words');
const doc = new aw.Document("Document.docx");
const apiKey = process.env.API_KEY;
// Sử dụng các mô hình ngôn ngữ tạo sinh của Google.
const model = aw.AI.AiModel.createGemini15Flash();
model.setApiKey(apiKey);
const translatedDoc = model.translate(doc, aw.AI.Language.Arabic);
translatedDoc.save("Output.docx");
const aw = require('@aspose/words');
const doc = new aw.Document("Document.docx");
// Pass an empty string if the self-hosted model does not require an API key.
const model = new CustomAiModel("my-model-24b", "https://your-server.com/v1");
model.setApiKey("");
const translatedDoc = model.translate(doc, aw.AI.Language.Arabic);
translatedDoc.save("Output.docx");
class CustomAiModel extends aw.AI.OpenAiModel {
constructor(name, url) {
super(name);
this._url = url;
}
get url() {
return this._url;
}
}
We host our Node.js via .Net packages in NPM repositories. Please follow the step-by-step instructions on how to install "Aspose.Words for Node.js via .NET" to your developer environment.
This package is compatible with Node.js 14.17.0 or higher.