3.2
接口地址:http://localhost:8080/chat/send
请求参数:
{
"model": "doubao-seed-1-6-251015",
"message": "50字介绍勾股定理",
"msgId" : "666",
"stream": true
}
非流式输出结构
{
"code": 0,
"msg": "success",
"data": {
"model": "doubao-seed-1-6-251015",
"messages": [
{
"role": "system",
"content": "你现在一名专业的数学老师,正在回答学生提问,请用简单明了的方式解答"
},
{
"role": "user",
"content": "50字介绍三角函数"
},
{
"role": "assistant",
"content": "三角函数是研究三角形边角关系或单位圆坐标比的工具,包含sin、cos、tan等,可解三角形、分析波与振动等周期现象。"
},
{
"role": "user",
"content": "50字介绍勾股定理"
},
{
"role": "assistant",
"content": "勾股定理是古代发现的直角三角形基本定理,指两直角边的平方和等于斜边的平方,常用于几何测量与边长计算。"
},
{
"role": "user",
"content": "50字介绍勾股定理"
},
{
"role": "assistant",
"content": "直角三角形中两直角边的平方和等于斜边的平方,是几何重要基础定理,广泛用于测量、建筑等实际问题的计算。"
}
],
"stream": false,
"ENABLE_thinking": false
}
}
type SendResponse struct {
Id string `json:"id"`
Object string `json:"object"`
Created int `json:"created"`
Model string `json:"model"`
Choices []struct {
Index int `json:"index"`
Message struct {
Role string `json:"role"`
Content string `json:"content"`
ToolCalls []ToolCall `json:"tool_calls"`
} `json:"message"`
Logprobs interface{} `json:"logprobs"`
FinishReason string `json:"finish_reason"`
} `json:"choices"`
Usage struct {
PromptTokens int `json:"prompt_tokens"`
CompletionTokens int `json:"completion_tokens"`
TotalTokens int `json:"total_tokens"`
PromptTokensDetails struct {
CachedTokens int `json:"cached_tokens"`
} `json:"prompt_tokens_details"`
PromptCacheHitTokens int `json:"prompt_cache_hit_tokens"`
PromptCacheMissTokens int `json:"prompt_cache_miss_tokens"`
} `json:"usage"`
SystemFingerprint string `json:"system_fingerprint"`
}
type ResponseBody struct {
Choices []Choices `json:"choices"`
Object string `json:"object"`
Created int `json:"created"`
SystemFingerprint string `json:"system_fingerprint"`
Model string `json:"model"`
Id string `json:"id"`
}
type Choices struct {
FinishReason string `json:"finish_reason"`
Delta Delta `json:"delta"`
Index int `json:"index"`
Logprobs string `json:"logprobs"`
}
type Delta struct {
Content string `json:"content"`
}
// {
// "choices": [
// {
// "finish_reason": "stop",
// "delta": {
// "content": "这道题吗?"
// },
// "index": 0,
// "logprobs": null
// }
// ],
// "object": "chat.completion.chunk",
// "usage": null,
// "created": 1749980398,
// "system_fingerprint": null,
// "model": "qwen-max",
// "id": "chatcmpl-7fad516d-0c69-9ec3-93ce-b5c573b2d316"
// }
https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions
最后编辑:admin 更新时间:2025-11-16 23:35