1234567891011121314151617181920212223242526 |
- import openai
- client = openai.OpenAI(
-
- )
- # 预设的对话内容
- messages = [
- {
- "role": "system",
- "content": "- 你名为epub翻译大师,专注于将任意语言的文本翻译成中文。- 你在翻译过程中,力求保留原文语意,确保翻译的准确性和完整性。- 你特别注重翻译结果要贴合现代人的阅读习惯,使译文更加流畅易懂。- 在处理包含代码结构的文本时,你会特别注意保持代码的原样,只在必要时提供相应的语言注释。- 你的服务旨在为用户提供高效、便捷的翻译体验,帮助用户跨越语言障碍。- 在回答问题的时候,尽可能保留原来的代码结构。- 输出内容要求用代码块包裹起来"
- },
- {
- "role": "user",
- "content": """```<p class="p34">It was on the evening of this Saturday that Arthur gathered up his courage and asked Angela to come and walk through the ruins with him. Angela hesitated a little; the shadow of something about to happen had fallen on her mind; but the extraordinary beauty of the evening, to say nothing of the prospect of his company, turned the scale in Arthur’s favour.</p>
- <p class="p34">It was one of those nights of which, if we are lucky, we get some five or six in the course of an English summer. The moon was at her full, and, the twilight ended, she filled the heavens with her light. Every twig and blade of grass showed out as clearly as in the day, but looked like frosted silver. The silence was intense, and so still was the air that the sharp shadows of the trees were motionless upon the grass, only growing with the growing hours. It was one of those nights that fill us with an indescribable emotion, bringing us into closer companionship with the unseen than ever does the garish, busy day. In such an hour, we can sometimes feel, or think that we can feel, other presences around us, and involuntarily we listen for the whisper of the wings and the half-forgotten voices of our beloved.</p>
- <p class="p34">On this particular evening some such feeling was stirring in Angela’s heart as with slow steps she led the way into the little village churchyard, a similar spot to that which is to be found in many a country parish, except that, the population being very small, there were but few recent graves. Most of the mounds had no head-stones to recall the names of the neglected dead, but here and there were dotted discoloured slabs, some sunk a foot or two into the soil, a few lying prone upon it, and the remainder thrown by the gradual subsidence of their supports into every variety of angle, as though they had been suddenly halted in the maddest whirl of a grotesque dance of death.</p>```"""
- }
- ]
- response = client.chat.completions.create(
- model="Qwen/Qwen3-32B",
- messages=messages
- )
- print(response.choices[0].message.content)
|