|
@@ -243,46 +243,25 @@ export default {
|
|
aiGet2(messages, callback) {
|
|
aiGet2(messages, callback) {
|
|
// console.log(this.toolIndex, this.wIndex);
|
|
// console.log(this.toolIndex, this.wIndex);
|
|
let _this = this;
|
|
let _this = this;
|
|
- // let parm = {
|
|
|
|
- // assistant_id: "6063369f-289a-11ef-8bf4-12e77c4cb76b",
|
|
|
|
- // message: [
|
|
|
|
- // {
|
|
|
|
- // type: "text",
|
|
|
|
- // text: messages.replaceAll("\n", " ").replaceAll("*", "")
|
|
|
|
- // }
|
|
|
|
- // ],
|
|
|
|
- // session_name: uuidv4(),
|
|
|
|
- // userId: this.userid,
|
|
|
|
- // file_ids: ""
|
|
|
|
- // };
|
|
|
|
|
|
+
|
|
let params = {
|
|
let params = {
|
|
- // "model": "Chat",
|
|
|
|
- model: "gpt-4o",
|
|
|
|
- temperature: 0,
|
|
|
|
- max_tokens: 4096,
|
|
|
|
- top_p: 1,
|
|
|
|
- frequency_penalty: 0,
|
|
|
|
- presence_penalty: 0,
|
|
|
|
- messages: [
|
|
|
|
- {
|
|
|
|
- content: messages.replaceAll("\n", " ").replaceAll("*", ""),
|
|
|
|
- role: "user"
|
|
|
|
- }
|
|
|
|
- ],
|
|
|
|
- stream: false,
|
|
|
|
- uid: this.userid,
|
|
|
|
- mind_map_question: ""
|
|
|
|
|
|
+ assistant_id: 'f8e1ebb2-2e0d-11ef-8bf4-12e77c4cb76b',
|
|
|
|
+ message: [{"type":"text", "text":messages.replaceAll('\n', " ").replaceAll('*', "")}],
|
|
|
|
+ session_name: uuidv4(),
|
|
|
|
+ userId: this.userid,
|
|
|
|
+ file_ids: [],
|
|
|
|
+ model:'gpt-4o-2024-08-06'
|
|
};
|
|
};
|
|
this.ajax
|
|
this.ajax
|
|
- .post("https://gpt4.cocorobo.cn/chat", params)
|
|
|
|
|
|
+ .post("https://gpt4.cocorobo.cn/ai_agent_park_chat", params)
|
|
.then(response => {
|
|
.then(response => {
|
|
let data = response.data.FunctionResponse;
|
|
let data = response.data.FunctionResponse;
|
|
- console.log("data", data);
|
|
|
|
- if (data.choices && data.choices.length && data.choices[0].message) {
|
|
|
|
|
|
+ // console.log("data", data);
|
|
|
|
+ if (data.message) {
|
|
let dArray = {};
|
|
let dArray = {};
|
|
try {
|
|
try {
|
|
dArray = JSON.parse(
|
|
dArray = JSON.parse(
|
|
- data.choices[0].message.content
|
|
|
|
|
|
+ data.message
|
|
.replaceAll("```json", "")
|
|
.replaceAll("```json", "")
|
|
.replaceAll("```", "")
|
|
.replaceAll("```", "")
|
|
);
|
|
);
|
|
@@ -291,7 +270,7 @@ export default {
|
|
try {
|
|
try {
|
|
let regex = new RegExp("(?<=```json)([\\s\\S]*?)(?=```)");
|
|
let regex = new RegExp("(?<=```json)([\\s\\S]*?)(?=```)");
|
|
|
|
|
|
- let match = data.choices[0].message.content.match(regex);
|
|
|
|
|
|
+ let match = data.message.match(regex);
|
|
dArray = JSON.parse(
|
|
dArray = JSON.parse(
|
|
match[0]
|
|
match[0]
|
|
.replace(/\n/g, "")
|
|
.replace(/\n/g, "")
|
|
@@ -301,7 +280,7 @@ export default {
|
|
} catch (error) {
|
|
} catch (error) {
|
|
try {
|
|
try {
|
|
dArray = JSON.parse(
|
|
dArray = JSON.parse(
|
|
- data.choices[0].message.content
|
|
|
|
|
|
+ data.message
|
|
.replaceAll("```json", "")
|
|
.replaceAll("```json", "")
|
|
.replaceAll("# Solution", "")
|
|
.replaceAll("# Solution", "")
|
|
.replaceAll("```", "")
|
|
.replaceAll("```", "")
|
|
@@ -397,39 +376,28 @@ export default {
|
|
let _this = this;
|
|
let _this = this;
|
|
|
|
|
|
let params = {
|
|
let params = {
|
|
- // "model": "Chat",
|
|
|
|
- model: "gpt-4o",
|
|
|
|
- temperature: 0,
|
|
|
|
- max_tokens: 4096,
|
|
|
|
- top_p: 1,
|
|
|
|
- frequency_penalty: 0,
|
|
|
|
- presence_penalty: 0,
|
|
|
|
- messages: [
|
|
|
|
- {
|
|
|
|
- content: messages.replaceAll("\n", " ").replaceAll("*", ""),
|
|
|
|
- role: "user"
|
|
|
|
- }
|
|
|
|
- ],
|
|
|
|
- stream: false,
|
|
|
|
- uid: this.userid,
|
|
|
|
- mind_map_question: ""
|
|
|
|
|
|
+
|
|
|
|
+ assistant_id: 'f8e1ebb2-2e0d-11ef-8bf4-12e77c4cb76b',
|
|
|
|
+ message: [{"type":"text", "text":messages.replaceAll('\n', " ").replaceAll('*', "")}],
|
|
|
|
+ session_name: uuidv4(),
|
|
|
|
+ userId: this.userid,
|
|
|
|
+ file_ids: [],
|
|
|
|
+ model:'gpt-4o-2024-08-06'
|
|
};
|
|
};
|
|
return new Promise(resolve => {
|
|
return new Promise(resolve => {
|
|
this.ajax
|
|
this.ajax
|
|
- .post("https://gpt4.cocorobo.cn/chat", params)
|
|
|
|
|
|
+ .post("https://gpt4.cocorobo.cn/ai_agent_park_chat", params)
|
|
.then(response => {
|
|
.then(response => {
|
|
let data = response.data.FunctionResponse;
|
|
let data = response.data.FunctionResponse;
|
|
// console.log(data);
|
|
// console.log(data);
|
|
|
|
|
|
if (
|
|
if (
|
|
- data.choices &&
|
|
|
|
- data.choices.length &&
|
|
|
|
- data.choices[0].message
|
|
|
|
|
|
+ data.message
|
|
) {
|
|
) {
|
|
let dArray = {};
|
|
let dArray = {};
|
|
try {
|
|
try {
|
|
dArray = JSON.parse(
|
|
dArray = JSON.parse(
|
|
- data.choices[0].message.content
|
|
|
|
|
|
+ data.message
|
|
.replaceAll("```json", "")
|
|
.replaceAll("```json", "")
|
|
.replaceAll("```", "")
|
|
.replaceAll("```", "")
|
|
);
|
|
);
|
|
@@ -438,7 +406,7 @@ export default {
|
|
try {
|
|
try {
|
|
let regex = new RegExp("(?<=```json)([\\s\\S]*?)(?=```)");
|
|
let regex = new RegExp("(?<=```json)([\\s\\S]*?)(?=```)");
|
|
|
|
|
|
- let match = data.choices[0].message.content.match(regex);
|
|
|
|
|
|
+ let match = data.message.match(regex);
|
|
// console.log("dArray2", match);
|
|
// console.log("dArray2", match);
|
|
dArray = JSON.parse(
|
|
dArray = JSON.parse(
|
|
match[0]
|
|
match[0]
|
|
@@ -450,7 +418,7 @@ export default {
|
|
} catch (error) {
|
|
} catch (error) {
|
|
try {
|
|
try {
|
|
dArray = JSON.parse(
|
|
dArray = JSON.parse(
|
|
- data.choices[0].message.content
|
|
|
|
|
|
+ data.message
|
|
.replaceAll("```json", "")
|
|
.replaceAll("```json", "")
|
|
.replaceAll("# Solution", "")
|
|
.replaceAll("# Solution", "")
|
|
.replaceAll("```", "")
|
|
.replaceAll("```", "")
|