29 lines
1.1 KiB
Python
29 lines
1.1 KiB
Python
|
import os
|
|||
|
from openai import OpenAI
|
|||
|
|
|||
|
from Config.Config import ALY_LLM_API_KEY
|
|||
|
|
|||
|
client = OpenAI(
|
|||
|
api_key=ALY_LLM_API_KEY,
|
|||
|
base_url="https://dashscope.aliyuncs.com/compatible-mode/v1",
|
|||
|
)
|
|||
|
|
|||
|
content="""
|
|||
|
1. 开发一个html5的页面代码
|
|||
|
2. 左侧实时仿真实验区:可拖拽改变物体密度、液体密度,参数可以实时改变物体浮沉状态;物体用小方块来模拟即可。
|
|||
|
3. 右侧动态受力图:用箭头实时显示重力与浮力大小关系;
|
|||
|
4. 生活案例切换:潜水艇、热气球、死海漂浮,一键切换并自动带入对应参数;
|
|||
|
5. 公式与结论区:根据实时数据高亮对应的浮沉条件;
|
|||
|
6. 纯前端实现(HTML5 + ES6),无需任何外部库,复制即用。
|
|||
|
"""
|
|||
|
|
|||
|
completion = client.chat.completions.create(
|
|||
|
model="qwen3-coder-plus",
|
|||
|
messages=[
|
|||
|
{'role': 'system', 'content': 'You are a helpful assistant.'},
|
|||
|
{'role': 'user', 'content': content}],
|
|||
|
)
|
|||
|
print("="*20+"回复内容"+"="*20)
|
|||
|
print(completion.choices[0].message.content)
|
|||
|
print("="*20+"Token消耗"+"="*20)
|
|||
|
print(completion.usage)
|