Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Education
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄奎
Education
Commits
f697c92e
Commit
f697c92e
authored
Dec 30, 2024
by
吴春
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
047eab17
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
26 deletions
+28
-26
OpenAIModel.cs
Edu.Common/API/OpenAIModel.cs
+1
-1
AIStudentController.cs
Edu.WebApi/Controllers/AI/AIStudentController.cs
+27
-25
No files found.
Edu.Common/API/OpenAIModel.cs
View file @
f697c92e
...
@@ -12,7 +12,7 @@ namespace Edu.Common.API
...
@@ -12,7 +12,7 @@ namespace Edu.Common.API
public
int
AccountId
{
get
;
set
;
}
public
int
AccountId
{
get
;
set
;
}
public
int
ApplicationId
{
get
;
set
;
}
public
int
ApplicationId
{
get
;
set
;
}
public
string
KeyWord
{
get
;
set
;
}
public
string
KeyWord
{
get
;
set
;
}
public
string
TimeUtc
{
get
;
set
;
}
public
int
LogId
{
get
;
set
;
}
public
int
Status
{
get
;
set
;
}
public
int
Status
{
get
;
set
;
}
public
string
CompletionResultModel
{
get
;
set
;
}
public
string
CompletionResultModel
{
get
;
set
;
}
...
...
Edu.WebApi/Controllers/AI/AIStudentController.cs
View file @
f697c92e
...
@@ -229,9 +229,8 @@ namespace Edu.WebApi.Controllers.AI
...
@@ -229,9 +229,8 @@ namespace Edu.WebApi.Controllers.AI
return
ApiResult
.
Failed
(
jsonObject
.
GetStringValue
(
"msg"
));
return
ApiResult
.
Failed
(
jsonObject
.
GetStringValue
(
"msg"
));
}
}
}
}
return
ApiResult
.
Failed
(
"获取失败"
);
}
}
return
ApiResult
.
Success
(
);
return
ApiResult
.
Failed
(
"解析失败!"
);
}
}
else
if
(
supplierModel
.
SupplierType
==
Common
.
Enum
.
AI
.
SupplierTypeEnum
.
OpenAI
)
else
if
(
supplierModel
.
SupplierType
==
Common
.
Enum
.
AI
.
SupplierTypeEnum
.
OpenAI
)
{
{
...
@@ -247,18 +246,21 @@ namespace Edu.WebApi.Controllers.AI
...
@@ -247,18 +246,21 @@ namespace Edu.WebApi.Controllers.AI
AccountId
=
this
.
AppletUserInfo
.
AccountId
,
AccountId
=
this
.
AppletUserInfo
.
AccountId
,
ApplicationId
=
applicationId
,
ApplicationId
=
applicationId
,
KeyWord
=
keyWord
,
KeyWord
=
keyWord
,
TimeUtc
=
dateStr
,
LogId
=
0
,
Status
=
0
,
Status
=
0
,
CompletionResultModel
=
""
,
CompletionResultModel
=
""
,
};
};
Cache
.
User
.
UserReidsCache
.
Set
(
this
.
AppletUserInfo
.
AccountId
+
"_"
+
"TimeUtc"
+
dateStr
,
resultModel
,
Common
.
Config
.
JwtExpirTime
);
var
result
=
openai
.
Completions
.
CreateCompletionAsync
(
completion
);
var
result
=
openai
.
Completions
.
CreateCompletionAsync
(
completion
);
int
addId
=
aiModule
.
SetAIUseLogModule
(
userLogModel
);
int
addId
=
aiModule
.
SetAIUseLogModule
(
userLogModel
);
if
(
addId
>
0
)
{
Cache
.
User
.
UserReidsCache
.
Set
(
this
.
AppletUserInfo
.
AccountId
+
"_"
+
"LogId_"
+
addId
,
resultModel
,
Common
.
Config
.
JwtExpirTime
);
if
(
result
!=
null
)
if
(
result
!=
null
)
{
{
try
try
{
{
var
returnModel
=
Cache
.
User
.
UserReidsCache
.
OpenAIGet
(
this
.
AppletUserInfo
.
AccountId
+
"_"
+
"TimeUtc"
+
dateStr
);
resultModel
.
LogId
=
addId
;
var
returnModel
=
Cache
.
User
.
UserReidsCache
.
OpenAIGet
(
this
.
AppletUserInfo
.
AccountId
+
"_"
+
"LogId_"
+
addId
);
if
(
returnModel
!=
null
)
if
(
returnModel
!=
null
)
{
{
returnModel
.
Status
=
1
;
returnModel
.
Status
=
1
;
...
@@ -268,9 +270,8 @@ namespace Edu.WebApi.Controllers.AI
...
@@ -268,9 +270,8 @@ namespace Edu.WebApi.Controllers.AI
completionResult
=
JsonHelper
.
Serialize
(
result
.
Result
);
completionResult
=
JsonHelper
.
Serialize
(
result
.
Result
);
}
}
returnModel
.
CompletionResultModel
=
completionResult
;
returnModel
.
CompletionResultModel
=
completionResult
;
Cache
.
User
.
UserReidsCache
.
Set
(
this
.
AppletUserInfo
.
AccountId
+
"_"
+
"TimeUtc"
+
dateStr
,
resultModel
,
Common
.
Config
.
JwtExpirTime
);
Cache
.
User
.
UserReidsCache
.
Set
(
this
.
AppletUserInfo
.
AccountId
+
"_"
+
"LogId_"
+
addId
,
resultModel
,
Common
.
Config
.
JwtExpirTime
);
}
}
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
...
@@ -279,7 +280,8 @@ namespace Edu.WebApi.Controllers.AI
...
@@ -279,7 +280,8 @@ namespace Edu.WebApi.Controllers.AI
}
}
return
ApiResult
.
Success
(
data
:
new
{
result
=
resultModel
,
Id
=
addId
});
return
ApiResult
.
Success
(
data
:
new
{
result
=
resultModel
,
Id
=
addId
});
}
}
return
ApiResult
.
Success
();
}
return
ApiResult
.
Failed
(
"解析失败!"
);
}
}
/// <summary>
/// <summary>
...
@@ -289,18 +291,18 @@ namespace Edu.WebApi.Controllers.AI
...
@@ -289,18 +291,18 @@ namespace Edu.WebApi.Controllers.AI
[
HttpPost
]
[
HttpPost
]
public
ApiResult
GetOpenAIResult
()
public
ApiResult
GetOpenAIResult
()
{
{
string
dateStr
=
base
.
ParmJObj
.
GetStringValue
(
"TimeUtc"
);
//
string dateStr = base.ParmJObj.GetStringValue("TimeUtc");
int
Id
=
base
.
ParmJObj
.
GetInt
(
"Id"
,
0
);
int
Id
=
base
.
ParmJObj
.
GetInt
(
"Id"
,
0
);
if
(
string
.
IsNullOrWhiteSpace
(
dateStr
)
||
Id
<=
0
)
if
(
Id
<=
0
)
{
{
return
ApiResult
.
ParamIsNull
();
return
ApiResult
.
ParamIsNull
();
}
}
var
returnModel
=
Cache
.
User
.
UserReidsCache
.
OpenAIGet
(
this
.
AppletUserInfo
.
AccountId
+
"_"
+
"
TimeUtc"
+
dateStr
);
var
returnModel
=
Cache
.
User
.
UserReidsCache
.
OpenAIGet
(
this
.
AppletUserInfo
.
AccountId
+
"_"
+
"
LogId_"
+
Id
);
if
(
returnModel
==
null
)
if
(
returnModel
==
null
)
{
{
return
ApiResult
.
Failed
(
"获取失败请重新调用"
);
return
ApiResult
.
Failed
(
"获取失败请重新调用"
);
}
}
else
else
if
(
returnModel
.
Status
==
1
)
{
{
var
model
=
aiModule
.
GetAIUseLogEntity
(
Id
);
var
model
=
aiModule
.
GetAIUseLogEntity
(
Id
);
model
.
ResultInfo
=
returnModel
.
CompletionResultModel
;
model
.
ResultInfo
=
returnModel
.
CompletionResultModel
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment