Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
poc-api
Project
Project
Details
Activity
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
poc
poc-api
Commits
d53b2f5e
Commit
d53b2f5e
authored
Oct 18, 2024
by
alex yao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 应用下架
parent
f6930f20
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
53 additions
and
13 deletions
+53
-13
AgentApplicationInfoService.java
...nt_application/aggregate/AgentApplicationInfoService.java
+8
-0
AgentApplicationInfoServiceImpl.java
...ation/aggregate/impl/AgentApplicationInfoServiceImpl.java
+6
-0
AgentApplicationConstants.java
...agent_application/constant/AgentApplicationConstants.java
+3
-11
BizAgentApplicationInfoService.java
...t_application/service/BizAgentApplicationInfoService.java
+2
-0
BizAgentApplicationInfoServiceImpl.java
...tion/service/impl/BizAgentApplicationInfoServiceImpl.java
+18
-1
AgentApplicationRest.java
...ain/java/cn/com/poc/expose/rest/AgentApplicationRest.java
+5
-0
AgentApplicationRestImpl.java
...cn/com/poc/expose/rest/impl/AgentApplicationRestImpl.java
+11
-1
No files found.
src/main/java/cn/com/poc/agent_application/aggregate/AgentApplicationInfoService.java
View file @
d53b2f5e
...
...
@@ -22,6 +22,14 @@ public interface AgentApplicationInfoService {
Integer
[]
knowledgeIds
,
Integer
communicationTurn
,
Float
topP
,
List
<
Message
>
messages
,
List
<
Tool
>
tools
,
HttpServletResponse
httpServletResponse
)
throws
Exception
;
/**
* 应用下架
*
* @param agentId
* @return
*/
boolean
unPublish
(
String
agentId
)
throws
Exception
;
/**
* 角色指令AI生成
...
...
src/main/java/cn/com/poc/agent_application/aggregate/impl/AgentApplicationInfoServiceImpl.java
View file @
d53b2f5e
...
...
@@ -323,6 +323,12 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ
return
JsonUtils
.
deSerialize
(
res
.
substring
(
start
,
end
+
1
),
CreateAgentTitleAndDescEntity
.
class
);
}
@Override
public
boolean
unPublish
(
String
agentId
)
throws
Exception
{
bizAgentApplicationPublishService
.
deleteByAgentId
(
agentId
);
bizAgentApplicationInfoService
.
unPublish
(
agentId
);
return
true
;
}
/**
* 构建应用信息提示词
...
...
src/main/java/cn/com/poc/agent_application/constant/AgentApplicationConstants.java
View file @
d53b2f5e
...
...
@@ -2,24 +2,16 @@ package cn.com.poc.agent_application.constant;
public
interface
AgentApplicationConstants
{
interface
USE_AGENT_STATUS
{
String
PREVIEW
=
"preview"
;
String
PUBLISH
=
"publish"
;
}
interface
TOOLS
{
int
FUNCTION_NUMBER
=
4
;
}
interface
AGENT_PUBLISH_STATUS
{
String
DRAFT
=
"draft"
;
// 草稿
String
PUBLISH
=
"publish"
;
// 发布
String
UN_PUBLISH
=
"unPublish"
;
// 已下架
static
boolean
isPublishStatus
(
String
status
)
{
return
PUBLISH
.
equals
(
status
)
||
DRAFT
.
equals
(
status
);
return
PUBLISH
.
equals
(
status
)
||
DRAFT
.
equals
(
status
)
||
UN_PUBLISH
.
equals
(
status
)
;
}
}
...
...
src/main/java/cn/com/poc/agent_application/service/BizAgentApplicationInfoService.java
View file @
d53b2f5e
...
...
@@ -27,4 +27,6 @@ public interface BizAgentApplicationInfoService extends BaseService {
boolean
publish
(
String
agentId
)
throws
Exception
;
boolean
unPublish
(
String
agentId
);
}
\ No newline at end of file
src/main/java/cn/com/poc/agent_application/service/impl/BizAgentApplicationInfoServiceImpl.java
View file @
d53b2f5e
...
...
@@ -129,7 +129,7 @@ public class BizAgentApplicationInfoServiceImpl extends BaseServiceImpl
}
@Override
public
boolean
publish
(
String
agentId
)
throws
Exception
{
public
boolean
publish
(
String
agentId
)
{
Assert
.
notNull
(
agentId
);
BizAgentApplicationInfoModel
model
=
new
BizAgentApplicationInfoModel
();
model
.
setAgentId
(
agentId
);
...
...
@@ -138,11 +138,28 @@ public class BizAgentApplicationInfoServiceImpl extends BaseServiceImpl
if
(
CollectionUtils
.
isEmpty
(
models
))
{
return
false
;
}
model
=
models
.
get
(
0
);
model
.
setAgentPublishStatus
(
AgentApplicationConstants
.
AGENT_PUBLISH_STATUS
.
PUBLISH
);
this
.
repository
.
save
(
model
);
return
true
;
}
@Override
public
boolean
unPublish
(
String
agentId
)
{
Assert
.
notNull
(
agentId
);
BizAgentApplicationInfoModel
model
=
new
BizAgentApplicationInfoModel
();
model
.
setAgentId
(
agentId
);
model
.
setIsDeleted
(
CommonConstant
.
IsDeleted
.
N
);
List
<
BizAgentApplicationInfoModel
>
models
=
this
.
repository
.
findByExample
(
model
);
if
(
CollectionUtils
.
isEmpty
(
models
))
{
return
false
;
}
model
=
models
.
get
(
0
);
model
.
setAgentPublishStatus
(
AgentApplicationConstants
.
AGENT_PUBLISH_STATUS
.
UN_PUBLISH
);
this
.
repository
.
save
(
model
);
return
true
;
}
/**
* 参数验证和转换 Entity To Model
*
...
...
src/main/java/cn/com/poc/expose/rest/AgentApplicationRest.java
View file @
d53b2f5e
...
...
@@ -43,6 +43,11 @@ public interface AgentApplicationRest extends BaseRest {
@Permission
(
value
=
Access
.
Anonymous
)
BizAgentApplicationPublishDto
getInfo
(
@RequestParam
String
agentId
)
throws
Exception
;
/**
* 下架已发布应用
*/
void
unPublish
(
@RequestParam
String
agentId
)
throws
Exception
;
/**
* 追问
*/
...
...
src/main/java/cn/com/poc/expose/rest/impl/AgentApplicationRestImpl.java
View file @
d53b2f5e
package
cn
.
com
.
poc
.
expose
.
rest
.
impl
;
import
cn.com.poc.agent_application.aggregate.AgentApplicationInfoService
;
import
cn.com.poc.agent_application.convert.AgentApplicationInfoConvert
;
import
cn.com.poc.agent_application.convert.BizAgentApplicationDialoguesRecordConvert
;
import
cn.com.poc.agent_application.convert.BizAgentApplicationPublishConvert
;
...
...
@@ -46,6 +47,9 @@ public class AgentApplicationRestImpl implements AgentApplicationRest {
@Resource
private
AgentApplicationService
agentApplicationService
;
@Resource
private
AgentApplicationInfoService
agentApplicationInfoService
;
@Resource
private
BizAgentApplicationPublishService
bizAgentApplicationPublishService
;
...
...
@@ -98,6 +102,12 @@ public class AgentApplicationRestImpl implements AgentApplicationRest {
return
BizAgentApplicationPublishConvert
.
entityToDto
(
entity
);
}
@Override
public
void
unPublish
(
String
agentId
)
throws
Exception
{
Assert
.
notBlank
(
agentId
,
"应用ID不能为空"
);
agentApplicationInfoService
.
unPublish
(
agentId
);
}
@Override
public
List
<
String
>
createContinueQuestions
(
AgentApplicationCreateContinueQuesDto
dto
)
throws
Exception
{
cn
.
com
.
poc
.
common
.
utils
.
Assert
.
notNull
(
dto
.
getInput
(),
"input不能为空"
);
...
...
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