新增极光大模型调用
This commit is contained in:
parent
8ee2da7ff2
commit
36ff3e9eb0
59
simple.html
59
simple.html
@ -163,6 +163,10 @@
|
||||
<option value="male" selected>男</option>
|
||||
<option value="female" >女</option>
|
||||
</select>
|
||||
<select class="input" id="answer_type" style="margin-bottom: 16px;">
|
||||
<option value="jiguang" selected>极光</option>
|
||||
<option value="gongzheng">公证</option>
|
||||
</select>
|
||||
<div style="margin-bottom: 8px; width: 100%; text-align: left; color: var(--text-200);">会话ID</div>
|
||||
<input class="input" id="conversationId" placeholder="请输入会话ID" value="1920410565458886658" title="请输入会话ID" />
|
||||
</div>
|
||||
@ -180,7 +184,7 @@
|
||||
}
|
||||
let conversationL = ""
|
||||
const sex_audio = {
|
||||
"male": "gongzheng-v2",
|
||||
"male": "gongzheng-v4",
|
||||
"female": "presenter_female"
|
||||
}
|
||||
const audio = document.getElementById('audio')
|
||||
@ -300,20 +304,47 @@
|
||||
if (trigger_status) {
|
||||
try {
|
||||
trigger_status = false;
|
||||
const response = await fetch('http://14.103.170.252:6211/chat', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
query: data,
|
||||
response_mode: 'streaming',
|
||||
user: 'SYS002',
|
||||
conversation_id: conversationL,
|
||||
audio: audio.value
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
let plu = document.getElementById('answer_type')
|
||||
api_data = {}
|
||||
if (plu.value=="jiguang"){
|
||||
api_data = {
|
||||
"model": "bot-20250522162100-44785",
|
||||
"llm_type": "ours",
|
||||
"conversation_id": conversationL,
|
||||
"audio": audio.value,
|
||||
"stream": true,
|
||||
"stream_options": {"include_usage": true},
|
||||
"messages": [
|
||||
{
|
||||
"role": "system",
|
||||
"content": "你是一个知识渊博的马克思主义研究者,能够深入且清晰地阐述马克思主义相关的理论、思想等内容,以通俗易懂的语言向用户讲解,还能结合实际案例来加深用户对马克思主义的理解。"
|
||||
},
|
||||
{
|
||||
"role": "user",
|
||||
"content": data
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
} else{
|
||||
api_data = {
|
||||
query: data,
|
||||
response_mode: 'streaming',
|
||||
user: 'SYS002',
|
||||
conversation_id: conversationL,
|
||||
audio: audio.value
|
||||
}
|
||||
|
||||
}
|
||||
const response = await fetch('http://14.103.170.252:6211/chat', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(api_data)
|
||||
});
|
||||
const reader = response.body.getReader();
|
||||
const decoder = new TextDecoder();
|
||||
let pre_talk = '';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user