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
f1f5ed94
Commit
f1f5ed94
authored
Apr 18, 2025
by
Roger Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
编辑器需求
parent
a090f157
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
505 additions
and
7 deletions
+505
-7
AgentApplicationService.java
.../agent_application/aggregate/AgentApplicationService.java
+14
-0
AgentApplicationServiceImpl.java
...plication/aggregate/impl/AgentApplicationServiceImpl.java
+49
-4
AgentApplicationGCConfigConstants.java
...plication/constant/AgentApplicationGCConfigConstants.java
+25
-0
AiGcTemplateConstant.java
.../poc/agent_application/constant/AiGcTemplateConstant.java
+26
-0
ArticleExpandRequest.java
...m/poc/agent_application/request/ArticleExpandRequest.java
+31
-0
ArticleModificationRequest.java
...agent_application/request/ArticleModificationRequest.java
+31
-0
ArticleModifyToneRequest.java
...c/agent_application/request/ArticleModifyToneRequest.java
+30
-0
ArticlePolishRequest.java
...m/poc/agent_application/request/ArticlePolishRequest.java
+33
-0
ArticleRefineRequest.java
...m/poc/agent_application/request/ArticleRefineRequest.java
+34
-0
ArticleRewriteRequest.java
.../poc/agent_application/request/ArticleRewriteRequest.java
+31
-0
AiGcRest.java
...main/java/cn/com/poc/agent_application/rest/AiGcRest.java
+23
-0
AiGcRestImpl.java
.../cn/com/poc/agent_application/rest/impl/AiGcRestImpl.java
+42
-0
AiGcEditorService.java
.../com/poc/agent_application/service/AiGcEditorService.java
+48
-0
AiGcEditorServiceImpl.java
...agent_application/service/impl/AiGcEditorServiceImpl.java
+82
-0
exception.properties
...in/resources/framemax-config/i18n/en/exception.properties
+2
-1
exception.properties
...resources/framemax-config/i18n/zh_cn/exception.properties
+2
-1
exception.properties
...resources/framemax-config/i18n/zh_tw/exception.properties
+2
-1
No files found.
src/main/java/cn/com/poc/agent_application/aggregate/AgentApplicationService.java
View file @
f1f5ed94
...
...
@@ -4,6 +4,7 @@ import cn.com.poc.agent_application.entity.AgentResultEntity;
import
cn.com.poc.agent_application.entity.BizAgentApplicationInfoEntity
;
import
cn.com.poc.agent_application.entity.CreateAgentTitleAndDescEntity
;
import
cn.com.poc.agent_application.entity.KnowledgeSuperclassProblemConfig
;
import
cn.com.poc.agent_application.request.ArticleRewriteRequest
;
import
cn.com.poc.thirdparty.resource.demand.ai.constants.KnowledgeSearchTypeEnum
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.dialogue.Message
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.dialogue.Tool
;
...
...
@@ -141,4 +142,17 @@ public interface AgentApplicationService {
* @param memberId 用户id
*/
boolean
hasPublishAgentPermission
(
String
agentId
,
Long
memberId
);
/**
* 编辑器编辑功能
* @param agentGcConfigCode
* @param articleContent
* @param editorRequired
* @param httpServletResponse
* @return
* @throws Exception
*/
String
editorFunction
(
String
agentGcConfigCode
,
String
articleContent
,
String
editorRequired
,
HttpServletResponse
httpServletResponse
)
throws
Exception
;
}
src/main/java/cn/com/poc/agent_application/aggregate/impl/AgentApplicationServiceImpl.java
View file @
f1f5ed94
package
cn
.
com
.
poc
.
agent_application
.
aggregate
.
impl
;
import
cn.com.poc.agent_application.aggregate.AgentApplicationService
;
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.constant.AgentApplicationKnowledgeConstants
;
import
cn.com.poc.agent_application.constant.*
;
import
cn.com.poc.agent_application.domain.FunctionResult
;
import
cn.com.poc.agent_application.entity.*
;
import
cn.com.poc.agent_application.query.DialogsIdsQueryByAgentIdQueryItem
;
...
...
@@ -543,6 +540,54 @@ public class AgentApplicationServiceImpl implements AgentApplicationService {
return
false
;
}
/**
* 编辑器编辑功能
*
* @param agentGcConfigCode
* @param articleContent
* @param editorRequired
* @param httpServletResponse
* @return
* @throws Exception
*/
@Override
public
String
editorFunction
(
String
agentGcConfigCode
,
String
articleContent
,
String
editorRequired
,
HttpServletResponse
httpServletResponse
)
throws
Exception
{
if
(
StringUtils
.
isBlank
(
agentGcConfigCode
))
{
throw
new
I18nMessageException
(
"exception/agentGcConfigCode.does.not.exist"
);
}
BizAgentApplicationGcConfigEntity
configEntity
=
bizAgentApplicationGcConfigService
.
getByConfigCode
(
agentGcConfigCode
);
if
(
null
==
configEntity
||
StringUtils
.
isBlank
(
configEntity
.
getConfigSystem
()))
{
throw
new
I18nMessageException
(
"exception/create.[opening.statement].configuration.does.not.exist"
);
}
String
configSystem
=
configEntity
.
getConfigSystem
();
if
(
StringUtils
.
isNotBlank
(
configSystem
))
{
configSystem
=
configSystem
.
replace
(
"{"
+
AiGcTemplateConstant
.
ContentPlaceholder
.
EXAMPLE
+
"1}"
,
articleContent
);
configSystem
=
configSystem
.
replace
(
"{"
+
AiGcTemplateConstant
.
ContentPlaceholder
.
EXAMPLE
+
"2}"
,
editorRequired
);
}
Message
message
=
new
Message
();
message
.
setContent
(
configSystem
);
message
.
setRole
(
LLMRoleEnum
.
USER
.
getRole
());
List
<
Message
>
messages
=
new
ArrayList
<
Message
>()
{{
add
(
message
);
}};
LargeModelResponse
largeModelResponse
=
new
LargeModelResponse
();
largeModelResponse
.
setModel
(
configEntity
.
getLargeModel
());
largeModelResponse
.
setMessages
(
messages
.
toArray
(
new
Message
[
1
]));
largeModelResponse
.
setTopP
(
configEntity
.
getTopP
());
largeModelResponse
.
setUser
(
"POC-CREATE-PREAMBLE"
);
BufferedReader
bufferedReader
=
llmService
.
chatChunk
(
largeModelResponse
);
SSEUtil
sseUtil
=
new
SSEUtil
(
httpServletResponse
);
textOutputStream
(
sseUtil
,
bufferedReader
);
return
null
;
}
/**
* 执行LLM,并输出结果
*
...
...
src/main/java/cn/com/poc/agent_application/constant/AgentApplicationGCConfigConstants.java
View file @
f1f5ed94
...
...
@@ -17,5 +17,30 @@ public interface AgentApplicationGCConfigConstants {
String
AGENT_BASE_SYSTEM
=
"AgentBaseSystem"
;
/**
* 编辑器 语气
*/
String
EDITOR_ARTICLE_MODIFY_TONE
=
"EditorArticleModifyTone"
;
/**
* 编辑器文章润色
*/
String
EDITOR_ARTICLE_POLISH
=
"EditorArticlePolish"
;
/**
* 编辑器文章扩写
*/
String
EDITOR_ARTICLE_EXPAND
=
"EditorArticleExpand"
;
/**
* 编辑器文章简写
*/
String
EDITOR_ARTICLE_REFINE
=
"EditorArticleRefine"
;
/**
* 编辑器文章改写
*/
String
EDITOR_ARTICLERE_WRITE
=
"EditorArticleRewrite"
;
}
src/main/java/cn/com/poc/agent_application/constant/AiGcTemplateConstant.java
0 → 100644
View file @
f1f5ed94
package
cn
.
com
.
poc
.
agent_application
.
constant
;
public
interface
AiGcTemplateConstant
{
/**
* AI内容模板占位符
*/
interface
ContentPlaceholder
{
/**
* 占位符名前缀
*/
String
EXAMPLE
=
"example"
;
/**
* 完整占位符
*/
String
EXAMPLE_PLACEHOLDER
=
"{example}"
;
}
}
src/main/java/cn/com/poc/agent_application/request/ArticleExpandRequest.java
0 → 100644
View file @
f1f5ed94
package
cn
.
com
.
poc
.
agent_application
.
request
;
public
class
ArticleExpandRequest
{
/**
* 文章内容
*/
private
String
articleContent
;
public
String
getArticleContent
()
{
return
articleContent
;
}
public
void
setArticleContent
(
String
articleContent
)
{
this
.
articleContent
=
articleContent
;
}
/**
* 要求
*/
private
String
editorRequired
;
public
String
getEditorRequired
()
{
return
editorRequired
;
}
public
void
setEditorRequired
(
String
editorRequired
)
{
this
.
editorRequired
=
editorRequired
;
}
}
src/main/java/cn/com/poc/agent_application/request/ArticleModificationRequest.java
0 → 100644
View file @
f1f5ed94
package
cn
.
com
.
poc
.
agent_application
.
request
;
public
class
ArticleModificationRequest
{
/**
* 文章内容
*/
private
String
articleContent
;
/**
* 修改要求
*/
private
String
require
;
public
String
getRequire
()
{
return
require
;
}
/**
* 要求
*/
private
String
editorRequired
;
public
String
getEditorRequired
()
{
return
editorRequired
;
}
public
void
setEditorRequired
(
String
editorRequired
)
{
this
.
editorRequired
=
editorRequired
;
}
}
src/main/java/cn/com/poc/agent_application/request/ArticleModifyToneRequest.java
0 → 100644
View file @
f1f5ed94
package
cn
.
com
.
poc
.
agent_application
.
request
;
public
class
ArticleModifyToneRequest
{
/**
* 文章内容
*/
private
String
articleContent
;
public
String
getArticleContent
()
{
return
articleContent
;
}
public
void
setArticleContent
(
String
articleContent
)
{
this
.
articleContent
=
articleContent
;
}
/**
* 要求
*/
private
String
editorRequired
;
public
String
getEditorRequired
()
{
return
editorRequired
;
}
public
void
setEditorRequired
(
String
editorRequired
)
{
this
.
editorRequired
=
editorRequired
;
}
}
src/main/java/cn/com/poc/agent_application/request/ArticlePolishRequest.java
0 → 100644
View file @
f1f5ed94
package
cn
.
com
.
poc
.
agent_application
.
request
;
/**
*
*/
public
class
ArticlePolishRequest
{
/**
* 文章内容
*/
private
String
articleContent
;
public
String
getArticleContent
()
{
return
articleContent
;
}
public
void
setArticleContent
(
String
articleContent
)
{
this
.
articleContent
=
articleContent
;
}
/**
* 要求
*/
private
String
editorRequired
;
public
String
getEditorRequired
()
{
return
editorRequired
;
}
public
void
setEditorRequired
(
String
editorRequired
)
{
this
.
editorRequired
=
editorRequired
;
}
}
src/main/java/cn/com/poc/agent_application/request/ArticleRefineRequest.java
0 → 100644
View file @
f1f5ed94
package
cn
.
com
.
poc
.
agent_application
.
request
;
/**
* @author Zackery
* @create 2023-12-26 10:26
*/
public
class
ArticleRefineRequest
{
/**
* 文章内容
*/
private
String
articleContent
;
public
String
getArticleContent
()
{
return
articleContent
;
}
public
void
setArticleContent
(
String
articleContent
)
{
this
.
articleContent
=
articleContent
;
}
/**
* 要求
*/
private
String
editorRequired
;
public
String
getEditorRequired
()
{
return
editorRequired
;
}
public
void
setEditorRequired
(
String
editorRequired
)
{
this
.
editorRequired
=
editorRequired
;
}
}
src/main/java/cn/com/poc/agent_application/request/ArticleRewriteRequest.java
0 → 100644
View file @
f1f5ed94
package
cn
.
com
.
poc
.
agent_application
.
request
;
public
class
ArticleRewriteRequest
{
/**
* 文章内容
*/
private
String
articleContent
;
public
String
getArticleContent
()
{
return
articleContent
;
}
public
void
setArticleContent
(
String
articleContent
)
{
this
.
articleContent
=
articleContent
;
}
/**
* 要求
*/
private
String
editorRequired
;
public
String
getEditorRequired
()
{
return
editorRequired
;
}
public
void
setEditorRequired
(
String
editorRequired
)
{
this
.
editorRequired
=
editorRequired
;
}
}
\ No newline at end of file
src/main/java/cn/com/poc/agent_application/rest/AiGcRest.java
0 → 100644
View file @
f1f5ed94
package
cn
.
com
.
poc
.
agent_application
.
rest
;
import
cn.com.poc.agent_application.request.*
;
import
cn.com.yict.framemax.core.rest.BaseRest
;
import
cn.com.yict.framemax.web.permission.Access
;
import
cn.com.yict.framemax.web.permission.Permission
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
javax.servlet.http.HttpServletResponse
;
@Permission
(
value
=
Access
.
Safety
)
public
interface
AiGcRest
extends
BaseRest
{
void
articlePolish
(
@RequestBody
ArticlePolishRequest
request
,
HttpServletResponse
httpServletResponse
)
throws
Exception
;
void
articleRefine
(
@RequestBody
ArticleRefineRequest
request
,
HttpServletResponse
httpServletResponse
)
throws
Exception
;
void
articleExpand
(
@RequestBody
ArticleExpandRequest
request
,
HttpServletResponse
httpServletResponse
)
throws
Exception
;
void
articleModifyTone
(
@RequestBody
ArticleModifyToneRequest
request
,
HttpServletResponse
httpServletResponse
)
throws
Exception
;
void
articleRewrite
(
@RequestBody
ArticleRewriteRequest
request
,
HttpServletResponse
httpServletResponse
)
throws
Exception
;
}
\ No newline at end of file
src/main/java/cn/com/poc/agent_application/rest/impl/AiGcRestImpl.java
0 → 100644
View file @
f1f5ed94
package
cn
.
com
.
poc
.
agent_application
.
rest
.
impl
;
import
cn.com.poc.agent_application.request.*
;
import
cn.com.poc.agent_application.rest.AiGcRest
;
import
cn.com.poc.agent_application.service.AiGcEditorService
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletResponse
;
@Component
public
class
AiGcRestImpl
implements
AiGcRest
{
@Resource
private
AiGcEditorService
aiGcEditorService
;
@Override
public
void
articlePolish
(
@RequestBody
ArticlePolishRequest
request
,
HttpServletResponse
httpServletResponse
)
throws
Exception
{
aiGcEditorService
.
articlePolish
(
request
,
httpServletResponse
);
}
@Override
public
void
articleRefine
(
@RequestBody
ArticleRefineRequest
request
,
HttpServletResponse
httpServletResponse
)
throws
Exception
{
aiGcEditorService
.
articleRefine
(
request
,
httpServletResponse
);
}
@Override
public
void
articleExpand
(
@RequestBody
ArticleExpandRequest
request
,
HttpServletResponse
httpServletResponse
)
throws
Exception
{
aiGcEditorService
.
articleExpand
(
request
,
httpServletResponse
);
}
@Override
public
void
articleModifyTone
(
@RequestBody
ArticleModifyToneRequest
request
,
HttpServletResponse
httpServletResponse
)
throws
Exception
{
aiGcEditorService
.
articleModifyTone
(
request
,
httpServletResponse
);
}
@Override
public
void
articleRewrite
(
@RequestBody
ArticleRewriteRequest
request
,
HttpServletResponse
httpServletResponse
)
throws
Exception
{
aiGcEditorService
.
articleRewrite
(
request
,
httpServletResponse
);
}
}
\ No newline at end of file
src/main/java/cn/com/poc/agent_application/service/AiGcEditorService.java
0 → 100644
View file @
f1f5ed94
package
cn
.
com
.
poc
.
agent_application
.
service
;
import
cn.com.poc.agent_application.request.*
;
import
cn.com.yict.framemax.core.service.BaseService
;
import
javax.servlet.http.HttpServletResponse
;
/**
*
*/
public
interface
AiGcEditorService
extends
BaseService
{
/**
* 文章润色
*
* @param request 请求参数
*/
void
articlePolish
(
ArticlePolishRequest
request
,
HttpServletResponse
httpServletResponse
)
throws
Exception
;
/**
* 文章简写
*
* @param request 请求参数
*/
void
articleRefine
(
ArticleRefineRequest
request
,
HttpServletResponse
httpServletResponse
)
throws
Exception
;
/**
* 文章扩写
*
* @param request 请求参数
*/
void
articleExpand
(
ArticleExpandRequest
request
,
HttpServletResponse
httpServletResponse
)
throws
Exception
;
/**
* 更改语气
*
* @param request 请求参数
*/
void
articleModifyTone
(
ArticleModifyToneRequest
request
,
HttpServletResponse
httpServletResponse
)
throws
Exception
;
/**
* 文章改写
*
* @param request 请求参数
*/
void
articleRewrite
(
ArticleRewriteRequest
request
,
HttpServletResponse
httpServletResponse
)
throws
Exception
;
}
src/main/java/cn/com/poc/agent_application/service/impl/AiGcEditorServiceImpl.java
0 → 100644
View file @
f1f5ed94
package
cn
.
com
.
poc
.
agent_application
.
service
.
impl
;
import
cn.com.poc.agent_application.aggregate.AgentApplicationService
;
import
cn.com.poc.agent_application.constant.AgentApplicationGCConfigConstants
;
import
cn.com.poc.agent_application.request.*
;
import
cn.com.poc.agent_application.service.AiGcEditorService
;
import
cn.com.poc.common.utils.Assert
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletResponse
;
/**
*
*/
@Service
public
class
AiGcEditorServiceImpl
implements
AiGcEditorService
{
@Resource
private
AgentApplicationService
agentApplicationService
;
@Override
public
void
articlePolish
(
ArticlePolishRequest
request
,
HttpServletResponse
httpServletResponse
)
throws
Exception
{
Assert
.
notNull
(
request
,
"param is not null"
);
String
articleContent
=
request
.
getArticleContent
();
String
editorRequired
=
request
.
getEditorRequired
();
Assert
.
notBlank
(
articleContent
,
"请选择需要润色的文字"
);
agentApplicationService
.
editorFunction
(
AgentApplicationGCConfigConstants
.
EDITOR_ARTICLE_POLISH
,
articleContent
,
editorRequired
,
httpServletResponse
);
}
@Override
public
void
articleRefine
(
ArticleRefineRequest
request
,
HttpServletResponse
httpServletResponse
)
throws
Exception
{
Assert
.
notNull
(
request
,
"param is not null"
);
String
articleContent
=
request
.
getArticleContent
();
String
editorRequired
=
request
.
getEditorRequired
();
Assert
.
notBlank
(
articleContent
,
"请选择需要简写的文字"
);
//调用提问
agentApplicationService
.
editorFunction
(
AgentApplicationGCConfigConstants
.
EDITOR_ARTICLE_REFINE
,
articleContent
,
editorRequired
,
httpServletResponse
);
}
@Override
public
void
articleExpand
(
ArticleExpandRequest
request
,
HttpServletResponse
httpServletResponse
)
throws
Exception
{
Assert
.
notNull
(
request
,
"param is not null"
);
String
articleContent
=
request
.
getArticleContent
();
String
editorRequired
=
request
.
getEditorRequired
();
Assert
.
notBlank
(
articleContent
,
"请选择需要扩写的文字"
);
//调用提问
agentApplicationService
.
editorFunction
(
AgentApplicationGCConfigConstants
.
EDITOR_ARTICLE_EXPAND
,
articleContent
,
editorRequired
,
httpServletResponse
);
}
@Override
public
void
articleRewrite
(
ArticleRewriteRequest
request
,
HttpServletResponse
httpServletResponse
)
throws
Exception
{
Assert
.
notNull
(
request
,
"param is not null"
);
String
articleContent
=
request
.
getArticleContent
();
String
editorRequired
=
request
.
getEditorRequired
();
Assert
.
notBlank
(
articleContent
,
"请选择需要改写的文字"
);
//调用提问
agentApplicationService
.
editorFunction
(
AgentApplicationGCConfigConstants
.
EDITOR_ARTICLERE_WRITE
,
articleContent
,
editorRequired
,
httpServletResponse
);
}
@Override
public
void
articleModifyTone
(
ArticleModifyToneRequest
request
,
HttpServletResponse
httpServletResponse
)
throws
Exception
{
Assert
.
notNull
(
request
,
"param is not null"
);
String
articleContent
=
request
.
getArticleContent
();
String
editorRequired
=
request
.
getEditorRequired
();
Assert
.
notBlank
(
articleContent
,
"请选择需要修改的文字"
);
//调用提问
agentApplicationService
.
editorFunction
(
AgentApplicationGCConfigConstants
.
EDITOR_ARTICLE_MODIFY_TONE
,
articleContent
,
editorRequired
,
httpServletResponse
);
}
}
src/main/resources/framemax-config/i18n/en/exception.properties
View file @
f1f5ed94
...
...
@@ -85,4 +85,5 @@ qa.knowledge.document.struct.not.consistent=Inconsistent question and answer str
file.rows.more.than.1500
=
The document exceeds 1500 lines
file.columns.more.than.10
=
The document exceeds 10 columns
file.cell.content.more.than.850
=
Cell exceeds 850 characters
file.rows.content.more.than.3000
=
The document line exceeds 3000 characters
\ No newline at end of file
file.rows.content.more.than.3000
=
The document line exceeds 3000 characters
exception/
agentGcConfigCode.does.not.exist
=
The agentGcConfigCode no Exist
\ No newline at end of file
src/main/resources/framemax-config/i18n/zh_cn/exception.properties
View file @
f1f5ed94
...
...
@@ -85,4 +85,5 @@ qa.knowledge.document.struct.not.consistent=文档结构不一致
file.rows.more.than.1500
=
文档超出1500行
file.columns.more.than.10
=
文档超出10列
file.cell.content.more.than.850
=
单元格超出850字符数
file.rows.content.more.than.3000
=
文档行超出3000字符数
\ No newline at end of file
file.rows.content.more.than.3000
=
文档行超出3000字符数
exception/
agentGcConfigCode.does.not.exist
=
agentGcConfigCode 不能为空
\ No newline at end of file
src/main/resources/framemax-config/i18n/zh_tw/exception.properties
View file @
f1f5ed94
...
...
@@ -85,4 +85,5 @@ qa.knowledge.document.struct.not.consistent=文檔結構不一致
file.rows.more.than.1500
=
文檔超出1500行
file.columns.more.than.10
=
文檔超出10列
file.cell.content.more.than.850
=
單元格超出850字符數
file.rows.content.more.than.3000
=
文檔超出3000字符數
\ No newline at end of file
file.rows.content.more.than.3000
=
文檔超出3000字符數
exception/
agentGcConfigCode.does.not.exist
=
agentGcConfigCode不能爲空
\ 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