to:sync
This commit is contained in:
parent
e37919ea97
commit
c70bda98c9
@ -189,29 +189,29 @@
|
|||||||
slideBottom();
|
slideBottom();
|
||||||
|
|
||||||
// messagesList.push({role: "user", content: msg});
|
// messagesList.push({role: "user", content: msg});
|
||||||
const body = JSON.stringify({model: "google/gemma-7b-it:free", messages: [{role: "user", content: msg}]});
|
const body = JSON.stringify({ "prompt": msg});
|
||||||
// alert(body)
|
// alert(body)
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: 'https://openrouter.ai/api/v1/chat/completions',
|
url: '/v1/ai/completionsTest',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Authorization': 'Bearer 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'
|
|
||||||
},
|
},
|
||||||
data: body,
|
data: body,
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
let res1=res?.choices[0]?.message?.content;
|
// let res1=res?.choices[0]?.message?.content;
|
||||||
res1 = DOMPurify.sanitize(marked.parse(res1));
|
// res1 = DOMPurify.sanitize(marked.parse(res1));
|
||||||
addAIMessage(res1);
|
// addAIMessage(res1);
|
||||||
|
|
||||||
// if (res.code === 200) {
|
if (res.code === 0) {
|
||||||
// let answer = res.answer;
|
let answer = res.data;
|
||||||
// answer = marked.parse(answer);
|
// answer = marked.parse(answer);
|
||||||
// addAIMessage(answer);
|
answer = DOMPurify.sanitize(marked.parse(answer));
|
||||||
|
addAIMessage(answer);
|
||||||
// messageHistory = res.history;
|
// messageHistory = res.history;
|
||||||
// } else {
|
} else {
|
||||||
// addAIMessage("服务接口调用错误。");
|
addAIMessage("服务接口调用错误。");
|
||||||
// }
|
}
|
||||||
},
|
},
|
||||||
error: function (e) {
|
error: function (e) {
|
||||||
addAIMessage("服务接口调用异常。");
|
addAIMessage("服务接口调用异常。");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user