Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
midjourney-proxy
Overview
Overview
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
徐少华
midjourney-proxy
Commits
4adf1a63
Commit
4adf1a63
authored
Jul 27, 2023
by
xushaohua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:部署
parent
fa58bf39
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
12 additions
and
8 deletions
+12
-8
NotifyServiceImpl.java
...github/novicezk/midjourney/service/NotifyServiceImpl.java
+1
-1
TaskQueueHelper.java
...m/github/novicezk/midjourney/support/TaskQueueHelper.java
+1
-1
TaskTimeoutSchedule.java
...thub/novicezk/midjourney/support/TaskTimeoutSchedule.java
+1
-1
BotMessageListener.java
...ithub/novicezk/midjourney/wss/bot/BotMessageListener.java
+1
-1
UserMessageListener.java
...hub/novicezk/midjourney/wss/user/UserMessageListener.java
+2
-1
UserWebSocketStarter.java
...ub/novicezk/midjourney/wss/user/UserWebSocketStarter.java
+6
-3
No files found.
midjourney-proxy/src/main/java/com/github/novicezk/midjourney/service/NotifyServiceImpl.java
View file @
4adf1a63
...
@@ -52,7 +52,7 @@ public class NotifyServiceImpl implements NotifyService {
...
@@ -52,7 +52,7 @@ public class NotifyServiceImpl implements NotifyService {
try
{
try
{
ResponseEntity
<
String
>
responseEntity
=
postJson
(
notifyHook
,
paramsStr
);
ResponseEntity
<
String
>
responseEntity
=
postJson
(
notifyHook
,
paramsStr
);
if
(
responseEntity
.
getStatusCode
()
==
HttpStatus
.
OK
)
{
if
(
responseEntity
.
getStatusCode
()
==
HttpStatus
.
OK
)
{
log
.
debug
(
"推送任务变更成功, 任务ID: {}, status: {}, notifyHook: {}"
,
taskId
,
taskStatus
,
notifyHook
);
log
.
info
(
"推送任务变更成功, 任务ID: {}, status: {}, notifyHook: {}"
,
taskId
,
taskStatus
,
notifyHook
);
}
else
{
}
else
{
log
.
warn
(
"推送任务变更失败, 任务ID: {}, notifyHook: {}, code: {}, msg: {}"
,
taskId
,
notifyHook
,
responseEntity
.
getStatusCodeValue
(),
responseEntity
.
getBody
());
log
.
warn
(
"推送任务变更失败, 任务ID: {}, notifyHook: {}, code: {}, msg: {}"
,
taskId
,
notifyHook
,
responseEntity
.
getStatusCodeValue
(),
responseEntity
.
getBody
());
}
}
...
...
midjourney-proxy/src/main/java/com/github/novicezk/midjourney/support/TaskQueueHelper.java
View file @
4adf1a63
...
@@ -121,7 +121,7 @@ public class TaskQueueHelper {
...
@@ -121,7 +121,7 @@ public class TaskQueueHelper {
task
.
sleep
();
task
.
sleep
();
changeStatusAndNotify
(
task
,
task
.
getStatus
());
changeStatusAndNotify
(
task
,
task
.
getStatus
());
}
while
(
task
.
getStatus
()
==
TaskStatus
.
IN_PROGRESS
);
}
while
(
task
.
getStatus
()
==
TaskStatus
.
IN_PROGRESS
);
log
.
debug
(
"task finished, id: {}, status: {}"
,
task
.
getId
(),
task
.
getStatus
());
log
.
info
(
"task finished, id: {}, status: {}"
,
task
.
getId
(),
task
.
getStatus
());
}
catch
(
InterruptedException
e
)
{
}
catch
(
InterruptedException
e
)
{
Thread
.
currentThread
().
interrupt
();
Thread
.
currentThread
().
interrupt
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
midjourney-proxy/src/main/java/com/github/novicezk/midjourney/support/TaskTimeoutSchedule.java
View file @
4adf1a63
...
@@ -30,7 +30,7 @@ public class TaskTimeoutSchedule {
...
@@ -30,7 +30,7 @@ public class TaskTimeoutSchedule {
if
(
Set
.
of
(
TaskStatus
.
FAILURE
,
TaskStatus
.
SUCCESS
).
contains
(
task
.
getStatus
()))
{
if
(
Set
.
of
(
TaskStatus
.
FAILURE
,
TaskStatus
.
SUCCESS
).
contains
(
task
.
getStatus
()))
{
log
.
warn
(
"task status is failure/success but is in the queue, end it. id: {}"
,
task
.
getId
());
log
.
warn
(
"task status is failure/success but is in the queue, end it. id: {}"
,
task
.
getId
());
}
else
{
}
else
{
log
.
debug
(
"task timeout, id: {}"
,
task
.
getId
());
log
.
info
(
"task timeout, id: {}"
,
task
.
getId
());
task
.
fail
(
"任务超时"
);
task
.
fail
(
"任务超时"
);
}
}
Future
<?>
future
=
this
.
taskQueueHelper
.
getRunningFuture
(
task
.
getId
());
Future
<?>
future
=
this
.
taskQueueHelper
.
getRunningFuture
(
task
.
getId
());
...
...
midjourney-proxy/src/main/java/com/github/novicezk/midjourney/wss/bot/BotMessageListener.java
View file @
4adf1a63
...
@@ -58,7 +58,7 @@ public class BotMessageListener extends ListenerAdapter implements ApplicationLi
...
@@ -58,7 +58,7 @@ public class BotMessageListener extends ListenerAdapter implements ApplicationLi
if
(
CharSequenceUtil
.
isBlank
(
authorName
))
{
if
(
CharSequenceUtil
.
isBlank
(
authorName
))
{
authorName
=
"System"
;
authorName
=
"System"
;
}
}
log
.
debug
(
"{} - {}: {}"
,
messageType
.
name
(),
authorName
,
message
.
getContentRaw
());
log
.
info
(
"{} - {}: {}"
,
messageType
.
name
(),
authorName
,
message
.
getContentRaw
());
return
false
;
return
false
;
}
}
...
...
midjourney-proxy/src/main/java/com/github/novicezk/midjourney/wss/user/UserMessageListener.java
View file @
4adf1a63
...
@@ -48,7 +48,7 @@ public class UserMessageListener implements ApplicationListener<ApplicationStart
...
@@ -48,7 +48,7 @@ public class UserMessageListener implements ApplicationListener<ApplicationStart
return
true
;
return
true
;
}
}
String
authorName
=
data
.
optObject
(
"author"
).
map
(
a
->
a
.
getString
(
"username"
)).
orElse
(
"System"
);
String
authorName
=
data
.
optObject
(
"author"
).
map
(
a
->
a
.
getString
(
"username"
)).
orElse
(
"System"
);
log
.
debug
(
"{} - {}: {}"
,
messageType
.
name
(),
authorName
,
data
.
opt
(
"content"
).
orElse
(
""
));
log
.
info
(
"{} - {}: {}"
,
messageType
.
name
(),
authorName
,
data
.
opt
(
"content"
).
orElse
(
""
));
return
false
;
return
false
;
}
}
}
}
\ No newline at end of file
midjourney-proxy/src/main/java/com/github/novicezk/midjourney/wss/user/UserWebSocketStarter.java
View file @
4adf1a63
...
@@ -66,21 +66,24 @@ public class UserWebSocketStarter extends WebSocketAdapter implements WebSocketS
...
@@ -66,21 +66,24 @@ public class UserWebSocketStarter extends WebSocketAdapter implements WebSocketS
*/
*/
@Override
@Override
public
synchronized
void
start
()
throws
Exception
{
public
synchronized
void
start
()
throws
Exception
{
log
.
info
(
"socket开始连接"
);
this
.
decompressor
=
new
ZlibDecompressor
(
2048
);
this
.
decompressor
=
new
ZlibDecompressor
(
2048
);
this
.
heartExecutor
=
Executors
.
newSingleThreadScheduledExecutor
();
this
.
heartExecutor
=
Executors
.
newSingleThreadScheduledExecutor
();
WebSocketFactory
webSocketFactory
=
createWebSocketFactory
(
this
.
properties
);
WebSocketFactory
webSocketFactory
=
createWebSocketFactory
(
this
.
properties
);
this
.
socket
=
webSocketFactory
.
createSocket
(
this
.
discordHelper
.
getWss
()
+
"/?encoding=json&v=9&compress=zlib-stream"
);
this
.
socket
=
webSocketFactory
.
createSocket
(
this
.
discordHelper
.
getWss
()
+
"/?encoding=json&v=9&compress=zlib-stream"
);
log
.
info
(
"socket创建完成:{}"
,
this
.
discordHelper
.
getWss
()
+
"/?encoding=json&v=9&compress=zlib-stream"
);
this
.
socket
.
addListener
(
this
);
this
.
socket
.
addListener
(
this
);
this
.
socket
.
addHeader
(
"Accept-Encoding"
,
"gzip, deflate, br"
).
addHeader
(
"Accept-Language"
,
"en-US,en;q=0.9"
)
this
.
socket
.
addHeader
(
"Accept-Encoding"
,
"gzip, deflate, br"
).
addHeader
(
"Accept-Language"
,
"en-US,en;q=0.9"
)
.
addHeader
(
"Cache-Control"
,
"no-cache"
).
addHeader
(
"Pragma"
,
"no-cache"
)
.
addHeader
(
"Cache-Control"
,
"no-cache"
).
addHeader
(
"Pragma"
,
"no-cache"
)
.
addHeader
(
"Sec-WebSocket-Extensions"
,
"permessage-deflate; client_max_window_bits"
)
.
addHeader
(
"Sec-WebSocket-Extensions"
,
"permessage-deflate; client_max_window_bits"
)
.
addHeader
(
"User-Agent"
,
this
.
userAgent
);
.
addHeader
(
"User-Agent"
,
this
.
userAgent
);
this
.
socket
.
connect
();
this
.
socket
.
connect
();
log
.
info
(
"socket连接上了"
);
}
}
@Override
@Override
public
void
onConnected
(
WebSocket
websocket
,
Map
<
String
,
List
<
String
>>
headers
)
{
public
void
onConnected
(
WebSocket
websocket
,
Map
<
String
,
List
<
String
>>
headers
)
{
log
.
debug
(
"[gateway]连接上了websocket."
);
log
.
info
(
"[gateway]连接上了websocket."
);
this
.
connected
=
true
;
this
.
connected
=
true
;
}
}
...
@@ -114,10 +117,10 @@ public class UserWebSocketStarter extends WebSocketAdapter implements WebSocketS
...
@@ -114,10 +117,10 @@ public class UserWebSocketStarter extends WebSocketAdapter implements WebSocketS
}
else
if
(
opCode
==
WebSocketCode
.
HEARTBEAT
)
{
}
else
if
(
opCode
==
WebSocketCode
.
HEARTBEAT
)
{
send
(
DataObject
.
empty
().
put
(
"op"
,
WebSocketCode
.
HEARTBEAT
).
put
(
"d"
,
this
.
sequence
));
send
(
DataObject
.
empty
().
put
(
"op"
,
WebSocketCode
.
HEARTBEAT
).
put
(
"d"
,
this
.
sequence
));
}
else
if
(
opCode
==
WebSocketCode
.
INVALIDATE_SESSION
)
{
}
else
if
(
opCode
==
WebSocketCode
.
INVALIDATE_SESSION
)
{
log
.
debug
(
"[gateway] Invalid session."
);
log
.
info
(
"[gateway] Invalid session."
);
close
(
"session invalid"
);
close
(
"session invalid"
);
}
else
if
(
opCode
==
WebSocketCode
.
RECONNECT
)
{
}
else
if
(
opCode
==
WebSocketCode
.
RECONNECT
)
{
log
.
debug
(
"[gateway] Received opcode 7 (reconnect)."
);
log
.
info
(
"[gateway] Received opcode 7 (reconnect)."
);
close
(
"reconnect"
);
close
(
"reconnect"
);
}
else
if
(
opCode
==
WebSocketCode
.
DISPATCH
)
{
}
else
if
(
opCode
==
WebSocketCode
.
DISPATCH
)
{
onDispatch
(
data
);
onDispatch
(
data
);
...
...
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