代码块
发布时间:2023-08-21 分类:开发日志 浏览量:698
import requests
import json
url = "https://spark-api-open.xf-yun.com/v1/chat/completions"
data = {
"model": "4.0Ultra", # 指定请求的模型
"messages": [
{
"role": "user",
"content": "中国第一高楼是?"
}
],
"stream": True
}
header = {
"Authorization": "Bearer f55c27bd9b464a8a266ced556b4ec7a3:NzZkMzk3MjQ3ZDAwMGRmYjkxMDhhYjNh" # 注意此处替换自己的key和secret
}
response = requests.post(url, headers=header, json=data, stream=True)
if ( is_category(array( 1,5,6,7,8,9,11,12 )) ) { //多个栏目id
get_template_part('category-product');
} elseif ( in_category( 10 )) {//单个栏目id
get_template_part('category-blog');
} else {//其他调用默认模板
get_template_part('category-default' );
}
