Initial commit of akmon project
This commit is contained in:
36
components/supadb/rag.uts
Normal file
36
components/supadb/rag.uts
Normal file
@@ -0,0 +1,36 @@
|
||||
|
||||
// const agent_id = "2bb9fa0cbae011efbf780242ac120006";
|
||||
const agent_id = "15b01b26128111f08cd30242ac120006";
|
||||
// const agent_id = "9eb32c5395d64ac48752b25efdd3b3bb";
|
||||
// const requrl = "https://rag.oulog.com/v1/canvas/completion";
|
||||
const requrl = "https://rag.oulog.com/api/v1/agents_openai/"+agent_id+"/chat/completions";
|
||||
// let beareaToken = "ImQwODRkOGJlZjI3ZjExZWZhZTZhMDI0MmFjMTIwMDA2Ig.Z7wduA.DEPPVfSZaP2MBKJN8vw14VxOXG0";
|
||||
import { RAG_API_KEY } from "@/ak/config";
|
||||
let beareaToken = RAG_API_KEY
|
||||
export function requestCanvasCompletion(question) {
|
||||
const new_uuid = `${Date.now()}${Math.floor(Math.random() * 1e7)}`
|
||||
const messages = [{"role": "user", "content": question}]
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.request({
|
||||
url: requrl,
|
||||
method: "POST",
|
||||
data: {
|
||||
id: agent_id,
|
||||
messages: messages,
|
||||
stream: false,
|
||||
model:"deepseek-r1",
|
||||
message_id: new_uuid,
|
||||
},
|
||||
header: {
|
||||
"content-Type": "application/json",
|
||||
Authorization: 'Bearer '+beareaToken,
|
||||
},
|
||||
success: (res) => {
|
||||
resolve(res.data);
|
||||
},
|
||||
fail: (err) => {
|
||||
reject(err);
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user