我又来学新知识咯!
日进一小步,成功一大步 打卡打卡,学习学习 来学习咯 完了,快跟不上了 这个还是前两天的吧 滴滴,初入门看不懂,想学习,拿本书,打个卡 学习学习 每次学习一点,进步一次 stream = client.chat.completions.create(
model="deepseek-ai/DeepSeek-R1",
messages=messages,
stream=True
)
thinking_content = ""
final_response = ""
for chunk in stream:
if chunk.choices:
# 如果需要显示思考过程,可根据 delta 内容判断
if hasattr(chunk.choices.delta, 'reasoning_content'):
reasoning = chunk.choices.delta.reasoning_content or ""
thinking_content += reasoning
yield thinking_content, final_response
if hasattr(chunk.choices.delta, 'content'):
content = chunk.choices.delta.content or ""
final_response += content
yield thinking_content, final_response
yield thinking_content, final_response
messages.append({"role": "assistant", "content": final_response})
# 启动Gradio应用
demo.queue().launch(inbrowser=True) thankyou
@FishC
本帖最后由 hahalalala 于 2026-4-12 21:56 编辑这个代码要安装哪些依赖啊{:10_254:} @FishC这个代码都要安装哪些依赖啊 学习一下 好吧,钱不够用了