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
2f4aa601
Commit
2f4aa601
authored
Jan 03, 2025
by
alex yao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:NPE
parent
a38cec25
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
+7
-7
SetLongMemoryFunction.java
...demand/ai/function/long_memory/SetLongMemoryFunction.java
+1
-1
MemoryVariableWriter.java
...function/memory_variable_writer/MemoryVariableWriter.java
+5
-5
MemoryVariableWriterFunction.java
.../memory_variable_writer/MemoryVariableWriterFunction.java
+1
-1
No files found.
src/main/java/cn/com/poc/thirdparty/resource/demand/ai/function/long_memory/SetLongMemoryFunction.java
View file @
2f4aa601
...
...
@@ -55,7 +55,7 @@ public class SetLongMemoryFunction extends AbstractLargeModelFunction {
JSONObject
jsonObject
=
new
JSONObject
(
content
);
// 提取 content
String
contents
=
jsonObject
.
getStr
(
"content"
);
String
contentKey
=
SetLongMemoryConstants
.
REDIS_PREFIX
+
key
+
":"
+
BlContext
.
getCurrentUserNotException
().
getUserId
().
toString
()
;
String
contentKey
=
SetLongMemoryConstants
.
REDIS_PREFIX
+
key
;
redisService
.
hset
(
contentKey
,
DateUtils
.
getCurrTime
(),
contents
,
expireTime
);
return
"SUCCESS"
;
}
...
...
src/main/java/cn/com/poc/thirdparty/resource/demand/ai/function/memory_variable_writer/MemoryVariableWriter.java
View file @
2f4aa601
...
...
@@ -12,7 +12,7 @@ import java.util.Map;
public
class
MemoryVariableWriter
{
public
static
Map
<
Object
,
Object
>
get
(
String
key
)
{
String
redisKey
=
MemoryVariableWriterConstants
.
REDIS_PREFIX
+
key
+
":"
+
BlContext
.
getCurrentUserNotException
().
getUserId
().
toString
()
;
String
redisKey
=
MemoryVariableWriterConstants
.
REDIS_PREFIX
+
key
;
RedisService
redisService
=
SpringUtils
.
getBean
(
RedisService
.
class
);
if
(!
redisService
.
hasKey
(
redisKey
))
{
return
null
;
...
...
@@ -22,25 +22,25 @@ public class MemoryVariableWriter {
}
public
static
void
clean
(
String
key
)
{
String
redisKey
=
MemoryVariableWriterConstants
.
REDIS_PREFIX
+
key
+
":"
+
BlContext
.
getCurrentUserNotException
().
getUserId
().
toString
()
;
String
redisKey
=
MemoryVariableWriterConstants
.
REDIS_PREFIX
+
key
;
RedisService
redisService
=
SpringUtils
.
getBean
(
RedisService
.
class
);
redisService
.
del
(
redisKey
);
}
public
static
void
cleanByPre
(
String
key
)
{
String
redisKey
=
MemoryVariableWriterConstants
.
REDIS_PREFIX
+
key
+
":"
;
String
redisKey
=
MemoryVariableWriterConstants
.
REDIS_PREFIX
+
key
;
RedisService
redisService
=
SpringUtils
.
getBean
(
RedisService
.
class
);
redisService
.
delByPre
(
redisKey
);
}
public
static
void
delItem
(
String
identifier
,
String
...
items
)
{
String
redisKey
=
MemoryVariableWriterConstants
.
REDIS_PREFIX
+
identifier
+
":"
+
BlContext
.
getCurrentUserNotException
().
getUserId
().
toString
()
;
String
redisKey
=
MemoryVariableWriterConstants
.
REDIS_PREFIX
+
identifier
;
RedisService
redisService
=
SpringUtils
.
getBean
(
RedisService
.
class
);
redisService
.
hdel
(
redisKey
,
items
);
}
public
static
void
addItem
(
String
identifier
,
Map
<
String
,
Object
>
map
)
{
String
redisKey
=
MemoryVariableWriterConstants
.
REDIS_PREFIX
+
identifier
+
":"
+
BlContext
.
getCurrentUserNotException
().
getUserId
().
toString
()
;
String
redisKey
=
MemoryVariableWriterConstants
.
REDIS_PREFIX
+
identifier
;
RedisService
redisService
=
SpringUtils
.
getBean
(
RedisService
.
class
);
// 创建 JSONObject 对象
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
...
...
src/main/java/cn/com/poc/thirdparty/resource/demand/ai/function/memory_variable_writer/MemoryVariableWriterFunction.java
View file @
2f4aa601
...
...
@@ -45,7 +45,7 @@ public class MemoryVariableWriterFunction extends AbstractLargeModelFunction {
if
(
StringUtils
.
isBlank
(
content
)
||
StringUtils
.
isBlank
(
identifier
))
{
return
"FAIL"
;
}
String
contentKey
=
MemoryVariableWriterConstants
.
REDIS_PREFIX
+
identifier
+
":"
+
BlContext
.
getCurrentUserNotException
().
getUserId
().
toString
()
;
String
contentKey
=
MemoryVariableWriterConstants
.
REDIS_PREFIX
+
identifier
;
// 创建 JSONObject 对象
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
if
(
redisService
.
hasKey
(
contentKey
))
{
...
...
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