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
cd8ecc0b
Commit
cd8ecc0b
authored
Oct 10, 2024
by
alex yao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 搜索模型信息
parent
84d0d5e2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
40 deletions
+63
-40
AgentApplicationInfoServiceImpl.java
...ation/aggregate/impl/AgentApplicationInfoServiceImpl.java
+12
-6
BizAgentApplicationLargeModelListService.java
...ion/service/BizAgentApplicationLargeModelListService.java
+4
-2
BizAgentApplicationLargeModelListServiceImpl.java
...ce/impl/BizAgentApplicationLargeModelListServiceImpl.java
+47
-32
No files found.
src/main/java/cn/com/poc/agent_application/aggregate/impl/AgentApplicationInfoServiceImpl.java
View file @
cd8ecc0b
...
...
@@ -4,12 +4,10 @@ import cn.com.poc.agent_application.aggregate.AgentApplicationInfoService;
import
cn.com.poc.agent_application.constant.AgentApplicationConstants
;
import
cn.com.poc.agent_application.constant.AgentApplicationDialoguesRecordConstants
;
import
cn.com.poc.agent_application.constant.AgentApplicationGCConfigConstants
;
import
cn.com.poc.agent_application.entity.BizAgentApplicationGcConfigEntity
;
import
cn.com.poc.agent_application.entity.BizAgentApplicationInfoEntity
;
import
cn.com.poc.agent_application.entity.BizAgentApplicationPublishEntity
;
import
cn.com.poc.agent_application.entity.CreateAgentTitleAndDescEntity
;
import
cn.com.poc.agent_application.entity.*
;
import
cn.com.poc.agent_application.service.BizAgentApplicationGcConfigService
;
import
cn.com.poc.agent_application.service.BizAgentApplicationInfoService
;
import
cn.com.poc.agent_application.service.BizAgentApplicationLargeModelListService
;
import
cn.com.poc.agent_application.service.BizAgentApplicationPublishService
;
import
cn.com.poc.common.utils.BlContext
;
import
cn.com.poc.common.utils.JsonUtils
;
...
...
@@ -32,7 +30,6 @@ import org.apache.commons.lang3.StringUtils;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.Assert
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletResponse
;
...
...
@@ -54,6 +51,9 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ
final
private
Logger
logger
=
LoggerFactory
.
getLogger
(
AgentApplicationInfoService
.
class
);
@Resource
private
BizAgentApplicationLargeModelListService
bizAgentApplicationLargeModelListService
;
@Resource
private
BizAgentApplicationGcConfigService
bizAgentApplicationGcConfigService
;
...
...
@@ -95,13 +95,19 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ
@Override
public
String
callAgentApplication
(
String
largeModel
,
String
[]
unitIds
,
String
agentSystem
,
String
[]
knowledgeIds
,
Integer
communicationTurn
,
Float
topP
,
List
<
Message
>
messages
,
HttpServletResponse
httpServletResponse
)
throws
Exception
{
logger
.
info
(
"--------- Call Agent Application large model:{},unitIds:{},agentSystem:{},knowledgeIds:{}"
+
" communicationTurn:{},topP:{},messages:{}--------------"
,
largeModel
,
unitIds
,
agentSystem
,
knowledgeIds
,
communicationTurn
,
topP
,
messages
);
BizAgentApplicationLargeModelListEntity
largeModelEntity
=
bizAgentApplicationLargeModelListService
.
findByModelNickName
(
largeModel
);
if
(
largeModelEntity
==
null
)
{
throw
new
BusinessException
(
"模型不存在"
);
}
//todo 调用组件
String
promptTemplate
=
buildDialogsPrompt
(
messages
,
agentSystem
,
knowledgeIds
);
Message
[]
messageArray
=
buildMessages
(
messages
,
communicationTurn
,
promptTemplate
);
BufferedReader
bufferedReader
=
invokeLLM
(
largeModel
,
messageArray
,
topP
);
BufferedReader
bufferedReader
=
invokeLLM
(
largeModel
Entity
.
getModelName
()
,
messageArray
,
topP
);
return
textOutput
(
httpServletResponse
,
bufferedReader
);
}
...
...
src/main/java/cn/com/poc/agent_application/service/BizAgentApplicationLargeModelListService.java
View file @
cd8ecc0b
package
cn
.
com
.
poc
.
agent_application
.
service
;
import
cn.com.yict.framemax.core.service.BaseService
;
import
cn.com.poc.agent_application.entity.BizAgentApplicationLargeModelListEntity
;
import
cn.com.yict.framemax.core.service.BaseService
;
import
cn.com.yict.framemax.data.model.PagingInfo
;
import
java.util.Collection
;
import
java.util.List
;
public
interface
BizAgentApplicationLargeModelListService
extends
BaseService
{
BizAgentApplicationLargeModelListEntity
findByModelNickName
(
String
modelNickName
);
BizAgentApplicationLargeModelListEntity
get
(
java
.
lang
.
Integer
id
)
throws
Exception
;
List
<
BizAgentApplicationLargeModelListEntity
>
findByExample
(
BizAgentApplicationLargeModelListEntity
example
,
PagingInfo
pagingInfo
)
throws
Exception
;
...
...
src/main/java/cn/com/poc/agent_application/service/impl/BizAgentApplicationLargeModelListServiceImpl.java
View file @
cd8ecc0b
package
cn
.
com
.
poc
.
agent_application
.
service
.
impl
;
package
cn
.
com
.
poc
.
agent_application
.
service
.
impl
;
import
cn.com.yict.framemax.core.service.impl.BaseServiceImpl
;
import
cn.com.poc.agent_application.service.BizAgentApplicationLargeModelListService
;
...
...
@@ -10,70 +10,85 @@ import cn.com.yict.framemax.data.model.PagingInfo;
import
org.springframework.stereotype.Service
;
import
org.apache.commons.collections4.CollectionUtils
;
import
java.util.ArrayList
;
import
java.util.stream.Collectors
;
import
java.util.List
;
import
javax.annotation.Resource
;
import
org.springframework.util.Assert
;
@Service
public
class
BizAgentApplicationLargeModelListServiceImpl
extends
BaseServiceImpl
implements
BizAgentApplicationLargeModelListService
{
@Resource
private
BizAgentApplicationLargeModelListRepository
repository
;
public
BizAgentApplicationLargeModelListEntity
get
(
java
.
lang
.
Integer
id
)
throws
Exception
{
implements
BizAgentApplicationLargeModelListService
{
@Resource
private
BizAgentApplicationLargeModelListRepository
repository
;
@Override
public
BizAgentApplicationLargeModelListEntity
findByModelNickName
(
String
modelNickName
)
{
Assert
.
notNull
(
modelNickName
);
BizAgentApplicationLargeModelListModel
bizAgentApplicationLargeModelListModel
=
new
BizAgentApplicationLargeModelListModel
();
bizAgentApplicationLargeModelListModel
.
setModelNickName
(
modelNickName
);
List
<
BizAgentApplicationLargeModelListModel
>
models
=
this
.
repository
.
findByExample
(
bizAgentApplicationLargeModelListModel
);
if
(
CollectionUtils
.
isNotEmpty
(
models
))
{
return
BizAgentApplicationLargeModelListConvert
.
modelToEntity
(
models
.
get
(
0
));
}
return
null
;
}
public
BizAgentApplicationLargeModelListEntity
get
(
java
.
lang
.
Integer
id
)
throws
Exception
{
Assert
.
notNull
(
id
);
BizAgentApplicationLargeModelListModel
model
=
this
.
repository
.
get
(
id
);
if
(
model
==
null
){
BizAgentApplicationLargeModelListModel
model
=
this
.
repository
.
get
(
id
);
if
(
model
==
null
)
{
return
null
;
}
return
BizAgentApplicationLargeModelListConvert
.
modelToEntity
(
model
);
}
}
public
List
<
BizAgentApplicationLargeModelListEntity
>
findByExample
(
BizAgentApplicationLargeModelListEntity
example
,
PagingInfo
pagingInfo
)
throws
Exception
{
List
<
BizAgentApplicationLargeModelListEntity
>
result
=
new
ArrayList
<
BizAgentApplicationLargeModelListEntity
>();
public
List
<
BizAgentApplicationLargeModelListEntity
>
findByExample
(
BizAgentApplicationLargeModelListEntity
example
,
PagingInfo
pagingInfo
)
throws
Exception
{
List
<
BizAgentApplicationLargeModelListEntity
>
result
=
new
ArrayList
<
BizAgentApplicationLargeModelListEntity
>();
BizAgentApplicationLargeModelListModel
model
=
new
BizAgentApplicationLargeModelListModel
();
if
(
example
!=
null
){
if
(
example
!=
null
)
{
model
=
BizAgentApplicationLargeModelListConvert
.
entityToModel
(
example
);
}
List
<
BizAgentApplicationLargeModelListModel
>
models
=
this
.
repository
.
findByExample
(
model
,
pagingInfo
);
List
<
BizAgentApplicationLargeModelListModel
>
models
=
this
.
repository
.
findByExample
(
model
,
pagingInfo
);
if
(
CollectionUtils
.
isNotEmpty
(
models
))
{
result
=
models
.
stream
().
map
(
BizAgentApplicationLargeModelListConvert:
:
modelToEntity
).
collect
(
Collectors
.
toList
());
}
return
result
;
}
public
BizAgentApplicationLargeModelListEntity
save
(
BizAgentApplicationLargeModelListEntity
entity
)
throws
Exception
{
public
BizAgentApplicationLargeModelListEntity
save
(
BizAgentApplicationLargeModelListEntity
entity
)
throws
Exception
{
Assert
.
notNull
(
entity
);
entity
.
setId
(
null
);
BizAgentApplicationLargeModelListModel
model
=
BizAgentApplicationLargeModelListConvert
.
entityToModel
(
entity
);
BizAgentApplicationLargeModelListModel
saveModel
=
this
.
repository
.
save
(
model
);
BizAgentApplicationLargeModelListModel
saveModel
=
this
.
repository
.
save
(
model
);
return
BizAgentApplicationLargeModelListConvert
.
modelToEntity
(
saveModel
);
}
public
BizAgentApplicationLargeModelListEntity
update
(
BizAgentApplicationLargeModelListEntity
entity
)
throws
Exception
{
public
BizAgentApplicationLargeModelListEntity
update
(
BizAgentApplicationLargeModelListEntity
entity
)
throws
Exception
{
Assert
.
notNull
(
entity
);
Assert
.
notNull
(
entity
.
getId
(),
"update pk can not be null"
);
Assert
.
notNull
(
entity
.
getId
(),
"update pk can not be null"
);
BizAgentApplicationLargeModelListModel
model
=
this
.
repository
.
get
(
entity
.
getId
());
if
(
entity
.
getModelName
()
!=
null
)
{
model
.
setModelName
(
entity
.
getModelName
());
}
if
(
entity
.
getOwner
()
!=
null
)
{
model
.
setOwner
(
entity
.
getOwner
());
}
BizAgentApplicationLargeModelListModel
saveModel
=
this
.
repository
.
save
(
model
);
if
(
entity
.
getModelName
()
!=
null
)
{
model
.
setModelName
(
entity
.
getModelName
());
}
if
(
entity
.
getOwner
()
!=
null
)
{
model
.
setOwner
(
entity
.
getOwner
());
}
BizAgentApplicationLargeModelListModel
saveModel
=
this
.
repository
.
save
(
model
);
return
BizAgentApplicationLargeModelListConvert
.
modelToEntity
(
saveModel
);
}
public
void
deletedById
(
java
.
lang
.
Integer
id
)
throws
Exception
{
public
void
deletedById
(
java
.
lang
.
Integer
id
)
throws
Exception
{
Assert
.
notNull
(
id
);
BizAgentApplicationLargeModelListModel
model
=
this
.
repository
.
get
(
id
);
if
(
model
!=
null
){
}
}
BizAgentApplicationLargeModelListModel
model
=
this
.
repository
.
get
(
id
);
if
(
model
!=
null
)
{
}
}
}
\ No newline at end of file
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