mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2025-04-13 22:02:58 +00:00
fix
This commit is contained in:
parent
8a2541b2a5
commit
d0a14c46f2
@ -44,7 +44,7 @@ def add_events(sio: socketio):
|
||||
forbid_remote_access(lollmsElfServer)
|
||||
|
||||
@sio.on("create_empty_message")
|
||||
def create_empty_message(sid, data):
|
||||
async def create_empty_message(sid, data):
|
||||
ASCIIColors.yellow("Creating empty user message")
|
||||
client_id = sid
|
||||
type = int(data.get("type", 0))
|
||||
@ -53,7 +53,7 @@ def add_events(sio: socketio):
|
||||
ASCIIColors.info(f"Building empty User message requested by : {client_id}")
|
||||
# send the message to the bot
|
||||
if lollmsElfServer.session.get_client(client_id).discussion:
|
||||
lollmsElfServer.new_message(
|
||||
await lollmsElfServer.new_message(
|
||||
client_id,
|
||||
lollmsElfServer.config.user_name,
|
||||
message,
|
||||
@ -68,7 +68,7 @@ def add_events(sio: socketio):
|
||||
# send the message to the bot
|
||||
print(f"Creating an empty message for AI answer orientation")
|
||||
if lollmsElfServer.session.get_client(client_id).discussion:
|
||||
lollmsElfServer.new_message(
|
||||
await lollmsElfServer.new_message(
|
||||
client_id,
|
||||
lollmsElfServer.personality.name,
|
||||
"[edit this to put your ai answer start]",
|
||||
@ -76,7 +76,7 @@ def add_events(sio: socketio):
|
||||
)
|
||||
|
||||
@sio.on("add_webpage")
|
||||
def add_webpage(sid, data):
|
||||
async def add_webpage(sid, data):
|
||||
lollmsElfServer.ShowBlockingMessage("Scraping web page\nPlease wait...")
|
||||
ASCIIColors.yellow("Scaping web page")
|
||||
client = lollmsElfServer.session.get_client(sid)
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
import{b as q,d as P,q as g,r as l,L as c,u as i,s as R,t as r,E as p}from"./index-Dk_fdEJ6.js";const b=1,$=33,m=34,v=35,x=36,d=new p(O=>{let e=O.pos;for(;;){if(O.next==10){O.advance();break}else if(O.next==123&&O.peek(1)==123||O.next<0)break;O.advance()}O.pos>e&&O.acceptToken(b)});function n(O,e,a){return new p(t=>{let u=t.pos;for(;t.next!=O&&t.next>=0&&(a||t.next!=38&&(t.next!=123||t.peek(1)!=123));)t.advance();t.pos>u&&t.acceptToken(e)})}const W=n(39,$,!1),C=n(34,m,!1),T=n(39,v,!0),f=n(34,x,!0),A=c.deserialize({version:14,states:"(jOVOqOOOeQpOOOvO!bO'#CaOOOP'#Cx'#CxQVOqOOO!OQpO'#CfO!WQpO'#ClO!]QpO'#CrO!bQpO'#CsOOQO'#Cv'#CvQ!gQpOOQ!lQpOOQ!qQpOOOOOV,58{,58{O!vOpO,58{OOOP-E6v-E6vO!{QpO,59QO#TQpO,59QOOQO,59W,59WO#YQpO,59^OOQO,59_,59_O#_QpOOO#_QpOOO#gQpOOOOOV1G.g1G.gO#oQpO'#CyO#tQpO1G.lOOQO1G.l1G.lO#|QpO1G.lOOQO1G.x1G.xO$UO`O'#DUO$ZOWO'#DUOOQO'#Co'#CoQOQpOOOOQO'#Cu'#CuO$`OtO'#CwO$qOrO'#CwOOQO,59e,59eOOQO-E6w-E6wOOQO7+$W7+$WO%SQpO7+$WO%[QpO7+$WOOOO'#Cp'#CpO%aOpO,59pOOOO'#Cq'#CqO%fOpO,59pOOOS'#Cz'#CzO%kOtO,59cOOQO,59c,59cOOOQ'#C{'#C{O%|OrO,59cO&_QpO<<GrOOQO<<Gr<<GrOOQO1G/[1G/[OOOS-E6x-E6xOOQO1G.}1G.}OOOQ-E6y-E6yOOQOAN=^AN=^",stateData:"&d~OvOS~OPROSQOVROWRO~OZTO[XO^VOaUOhWO~OR]OU^O~O[`O^aO~O[bO~O[cO~O[dO~ObeO~ObfO~ObgO~ORhO~O]kOwiO~O[lO~O_mO~OynOzoO~OysOztO~O[uO~O]wOwiO~O_yOwiO~OtzO~Os|O~OSQOV!OOW!OOr!OOy!QO~OSQOV!ROW!ROq!ROz!QO~O_!TOwiO~O]!UO~Oy!VO~Oz!VO~OSQOV!OOW!OOr!OOy!XO~OSQOV!ROW!ROq!ROz!XO~O]!ZO~O",goto:"#dyPPPPPzPPPP!WPPPPP!WPP!Z!^!a!d!dP!g!j!m!p!v#Q#WPPPPPPPP#^SROSS!Os!PT!Rt!SRYPRqeR{nR}oRZPRqfR[PRqgQSOR_SQj`SvjxRxlQ!PsR!W!PQ!StR!Y!SQpeRrf",nodeNames:"⚠ Text Content }} {{ Interpolation InterpolationContent Entity InvalidEntity Attribute BoundAttributeName [ Identifier ] ( ) ReferenceName # Is ExpressionAttributeValue AttributeInterpolation AttributeInterpolation EventName DirectiveName * StatementAttributeValue AttributeName AttributeValue",maxTerm:42,nodeProps:[["openedBy",3,"{{",15,"("],["closedBy",4,"}}",14,")"],["isolate",-4,5,19,25,27,""]],skippedNodes:[0],repeatNodeCount:4,tokenData:"0r~RyOX#rXY$mYZ$mZ]#r]^$m^p#rpq$mqr#rrs%jst&Qtv#rvw&hwx)zxy*byz*xz{+`{}#r}!O+v!O!P-]!P!Q#r!Q![+v![!]+v!]!_#r!_!`-s!`!c#r!c!}+v!}#O.Z#O#P#r#P#Q.q#Q#R#r#R#S+v#S#T#r#T#o+v#o#p/X#p#q#r#q#r0Z#r%W#r%W;'S+v;'S;:j-V;:j;=`$g<%lO+vQ#wTUQO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rQ$ZSO#q#r#r;'S#r;'S;=`$g<%lO#rQ$jP;=`<%l#rR$t[UQvPOX#rXY$mYZ$mZ]#r]^$m^p#rpq$mq#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR%qTyPUQO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR&XTaPUQO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR&oXUQWPOp'[pq#rq!]'[!]!^#r!^#q'[#q#r(d#r;'S'[;'S;=`)t<%lO'[R'aXUQOp'[pq#rq!]'[!]!^'|!^#q'[#q#r(d#r;'S'[;'S;=`)t<%lO'[R(TTVPUQO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR(gXOp'[pq#rq!]'[!]!^'|!^#q'[#q#r)S#r;'S'[;'S;=`)t<%lO'[P)VUOp)Sq!])S!]!^)i!^;'S)S;'S;=`)n<%lO)SP)nOVPP)qP;=`<%l)SR)wP;=`<%l'[R*RTzPUQO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR*iT^PUQO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR+PT_PUQO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR+gThPUQO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR+}b[PUQO}#r}!O+v!O!Q#r!Q![+v![!]+v!]!c#r!c!}+v!}#R#r#R#S+v#S#T#r#T#o+v#o#q#r#q#r$W#r%W#r%W;'S+v;'S;:j-V;:j;=`$g<%lO+vR-YP;=`<%l+vR-dTwPUQO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR-zTUQbPO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR.bTZPUQO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR.xT]PUQO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR/^VUQO#o#r#o#p/s#p#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR/zTSPUQO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#r~0^TO#q#r#q#r0m#r;'S#r;'S;=`$g<%lO#r~0rOR~",tokenizers:[d,W,C,T,f,0,1],topRules:{Content:[0,2],Attribute:[1,9]},tokenPrec:0}),V=i.parser.configure({top:"SingleExpression"}),Q=A.configure({props:[R({Text:r.content,Is:r.definitionOperator,AttributeName:r.attributeName,"AttributeValue ExpressionAttributeValue StatementAttributeValue":r.attributeValue,Entity:r.character,InvalidEntity:r.invalid,"BoundAttributeName/Identifier":r.attributeName,"EventName/Identifier":r.special(r.attributeName),"ReferenceName/Identifier":r.variableName,"DirectiveName/Identifier":r.keyword,"{{ }}":r.brace,"( )":r.paren,"[ ]":r.bracket,"# '*'":r.punctuation})]}),o={parser:V},w={parser:i.parser},U=Q.configure({wrap:l((O,e)=>O.name=="InterpolationContent"?o:null)}),y=Q.configure({wrap:l((O,e)=>{var a;return O.name=="InterpolationContent"?o:O.name!="AttributeInterpolation"?null:((a=O.node.parent)===null||a===void 0?void 0:a.name)=="StatementAttributeValue"?w:o}),top:"Attribute"}),E={parser:U},N={parser:y},s=g();function S(O){return O.configure({wrap:l(z)},"angular")}const k=S(s.language);function z(O,e){switch(O.name){case"Attribute":return/^[*#(\[]|\{\{/.test(e.read(O.from,O.to))?N:null;case"Text":return E}return null}function G(O={}){let e=s;if(O.base){if(O.base.language.name!="html"||!(O.base.language instanceof q))throw new RangeError("The base option must be the result of calling html(...)");e=O.base}return new P(e.language==s.language?k:S(e.language),[e.support,e.language.data.of({closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/})])}export{G as angular,k as angularLanguage};
|
||||
import{b as q,d as P,q as g,r as l,L as c,u as i,s as R,t as r,E as p}from"./index-DiFBq1n1.js";const b=1,$=33,m=34,v=35,x=36,d=new p(O=>{let e=O.pos;for(;;){if(O.next==10){O.advance();break}else if(O.next==123&&O.peek(1)==123||O.next<0)break;O.advance()}O.pos>e&&O.acceptToken(b)});function n(O,e,a){return new p(t=>{let u=t.pos;for(;t.next!=O&&t.next>=0&&(a||t.next!=38&&(t.next!=123||t.peek(1)!=123));)t.advance();t.pos>u&&t.acceptToken(e)})}const W=n(39,$,!1),C=n(34,m,!1),T=n(39,v,!0),f=n(34,x,!0),A=c.deserialize({version:14,states:"(jOVOqOOOeQpOOOvO!bO'#CaOOOP'#Cx'#CxQVOqOOO!OQpO'#CfO!WQpO'#ClO!]QpO'#CrO!bQpO'#CsOOQO'#Cv'#CvQ!gQpOOQ!lQpOOQ!qQpOOOOOV,58{,58{O!vOpO,58{OOOP-E6v-E6vO!{QpO,59QO#TQpO,59QOOQO,59W,59WO#YQpO,59^OOQO,59_,59_O#_QpOOO#_QpOOO#gQpOOOOOV1G.g1G.gO#oQpO'#CyO#tQpO1G.lOOQO1G.l1G.lO#|QpO1G.lOOQO1G.x1G.xO$UO`O'#DUO$ZOWO'#DUOOQO'#Co'#CoQOQpOOOOQO'#Cu'#CuO$`OtO'#CwO$qOrO'#CwOOQO,59e,59eOOQO-E6w-E6wOOQO7+$W7+$WO%SQpO7+$WO%[QpO7+$WOOOO'#Cp'#CpO%aOpO,59pOOOO'#Cq'#CqO%fOpO,59pOOOS'#Cz'#CzO%kOtO,59cOOQO,59c,59cOOOQ'#C{'#C{O%|OrO,59cO&_QpO<<GrOOQO<<Gr<<GrOOQO1G/[1G/[OOOS-E6x-E6xOOQO1G.}1G.}OOOQ-E6y-E6yOOQOAN=^AN=^",stateData:"&d~OvOS~OPROSQOVROWRO~OZTO[XO^VOaUOhWO~OR]OU^O~O[`O^aO~O[bO~O[cO~O[dO~ObeO~ObfO~ObgO~ORhO~O]kOwiO~O[lO~O_mO~OynOzoO~OysOztO~O[uO~O]wOwiO~O_yOwiO~OtzO~Os|O~OSQOV!OOW!OOr!OOy!QO~OSQOV!ROW!ROq!ROz!QO~O_!TOwiO~O]!UO~Oy!VO~Oz!VO~OSQOV!OOW!OOr!OOy!XO~OSQOV!ROW!ROq!ROz!XO~O]!ZO~O",goto:"#dyPPPPPzPPPP!WPPPPP!WPP!Z!^!a!d!dP!g!j!m!p!v#Q#WPPPPPPPP#^SROSS!Os!PT!Rt!SRYPRqeR{nR}oRZPRqfR[PRqgQSOR_SQj`SvjxRxlQ!PsR!W!PQ!StR!Y!SQpeRrf",nodeNames:"⚠ Text Content }} {{ Interpolation InterpolationContent Entity InvalidEntity Attribute BoundAttributeName [ Identifier ] ( ) ReferenceName # Is ExpressionAttributeValue AttributeInterpolation AttributeInterpolation EventName DirectiveName * StatementAttributeValue AttributeName AttributeValue",maxTerm:42,nodeProps:[["openedBy",3,"{{",15,"("],["closedBy",4,"}}",14,")"],["isolate",-4,5,19,25,27,""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'S+v;'S;:j-V;:j;=`$g<%lO+vR-YP;=`<%l+vR-dTwPUQO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR-zTUQbPO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR.bTZPUQO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR.xT]PUQO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR/^VUQO#o#r#o#p/s#p#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#rR/zTSPUQO#q#r#q#r$W#r;'S#r;'S;=`$g<%lO#r~0^TO#q#r#q#r0m#r;'S#r;'S;=`$g<%lO#r~0rOR~",tokenizers:[d,W,C,T,f,0,1],topRules:{Content:[0,2],Attribute:[1,9]},tokenPrec:0}),V=i.parser.configure({top:"SingleExpression"}),Q=A.configure({props:[R({Text:r.content,Is:r.definitionOperator,AttributeName:r.attributeName,"AttributeValue ExpressionAttributeValue StatementAttributeValue":r.attributeValue,Entity:r.character,InvalidEntity:r.invalid,"BoundAttributeName/Identifier":r.attributeName,"EventName/Identifier":r.special(r.attributeName),"ReferenceName/Identifier":r.variableName,"DirectiveName/Identifier":r.keyword,"{{ }}":r.brace,"( )":r.paren,"[ ]":r.bracket,"# '*'":r.punctuation})]}),o={parser:V},w={parser:i.parser},U=Q.configure({wrap:l((O,e)=>O.name=="InterpolationContent"?o:null)}),y=Q.configure({wrap:l((O,e)=>{var a;return O.name=="InterpolationContent"?o:O.name!="AttributeInterpolation"?null:((a=O.node.parent)===null||a===void 0?void 0:a.name)=="StatementAttributeValue"?w:o}),top:"Attribute"}),E={parser:U},N={parser:y},s=g();function S(O){return O.configure({wrap:l(z)},"angular")}const k=S(s.language);function z(O,e){switch(O.name){case"Attribute":return/^[*#(\[]|\{\{/.test(e.read(O.from,O.to))?N:null;case"Text":return E}return null}function G(O={}){let e=s;if(O.base){if(O.base.language.name!="html"||!(O.base.language instanceof q))throw new RangeError("The base option must be the result of calling html(...)");e=O.base}return new P(e.language==s.language?k:S(e.language),[e.support,e.language.data.of({closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/})])}export{G as angular,k as angularLanguage};
|
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
import{b as O,d as b,L as r,f as s,g as a,s as t,j as P,l as n,t as e}from"./index-Dk_fdEJ6.js";const S={__proto__:null,anyref:34,dataref:34,eqref:34,externref:34,i31ref:34,funcref:34,i8:34,i16:34,i32:34,i64:34,f32:34,f64:34},Q=r.deserialize({version:14,states:"!^Q]QPOOOqQPO'#CbOOQO'#Cd'#CdOOQO'#Cl'#ClOOQO'#Ch'#ChQ]QPOOOOQO,58|,58|OxQPO,58|OOQO-E6f-E6fOOQO1G.h1G.h",stateData:"!P~O_OSPOSQOS~OTPOVROXROYROZROaQO~OSUO~P]OSXO~P]O",goto:"xaPPPPPPbPbPPPhPPPrXROPTVQTOQVPTWTVXSOPTV",nodeNames:"⚠ LineComment BlockComment Module ) ( App Identifier Type Keyword Number String",maxTerm:17,nodeProps:[["isolate",-3,1,2,11,""],["openedBy",4,"("],["closedBy",5,")"],["group",-6,6,7,8,9,10,11,"Expression"]],skippedNodes:[0,1,2],repeatNodeCount:1,tokenData:"0o~R^XY}YZ}]^}pq}rs!Stu#pxy'Uyz(e{|(j}!O(j!Q!R(s!R![*p!]!^.^#T#o.{~!SO_~~!VVOr!Srs!ls#O!S#O#P!q#P;'S!S;'S;=`#j<%lO!S~!qOZ~~!tRO;'S!S;'S;=`!};=`O!S~#QWOr!Srs!ls#O!S#O#P!q#P;'S!S;'S;=`#j;=`<%l!S<%lO!S~#mP;=`<%l!S~#siqr%bst%btu%buv%bvw%bwx%bz{%b{|%b}!O%b!O!P%b!P!Q%b!Q![%b![!]%b!^!_%b!_!`%b!`!a%b!a!b%b!b!c%b!c!}%b#Q#R%b#R#S%b#S#T%b#T#o%b#p#q%b#r#s%b~%giV~qr%bst%btu%buv%bvw%bwx%bz{%b{|%b}!O%b!O!P%b!P!Q%b!Q![%b![!]%b!^!_%b!_!`%b!`!a%b!a!b%b!b!c%b!c!}%b#Q#R%b#R#S%b#S#T%b#T#o%b#p#q%b#r#s%b~'ZPT~!]!^'^~'aTO!]'^!]!^'p!^;'S'^;'S;=`(_<%lO'^~'sVOy'^yz(Yz!]'^!]!^'p!^;'S'^;'S;=`(_<%lO'^~(_OQ~~(bP;=`<%l'^~(jOS~~(mQ!Q!R(s!R![*p~(xUY~!O!P)[!Q![*p!g!h){#R#S+U#X#Y){#l#m+[~)aRY~!Q![)j!g!h){#X#Y){~)oSY~!Q![)j!g!h){#R#S*j#X#Y){~*OR{|*X}!O*X!Q![*_~*[P!Q![*_~*dQY~!Q![*_#R#S*X~*mP!Q![)j~*uTY~!O!P)[!Q![*p!g!h){#R#S+U#X#Y){~+XP!Q![*p~+_R!Q![+h!c!i+h#T#Z+h~+mVY~!O!P,S!Q![+h!c!i+h!r!s-P#R#S+[#T#Z+h#d#e-P~,XTY~!Q![,h!c!i,h!r!s-P#T#Z,h#d#e-P~,mUY~!Q![,h!c!i,h!r!s-P#R#S.Q#T#Z,h#d#e-P~-ST{|-c}!O-c!Q![-o!c!i-o#T#Z-o~-fR!Q![-o!c!i-o#T#Z-o~-tSY~!Q![-o!c!i-o#R#S-c#T#Z-o~.TR!Q![,h!c!i,h#T#Z,h~.aP!]!^.d~.iSP~OY.dZ;'S.d;'S;=`.u<%lO.d~.xP;=`<%l.d~/QiX~qr.{st.{tu.{uv.{vw.{wx.{z{.{{|.{}!O.{!O!P.{!P!Q.{!Q![.{![!].{!^!_.{!_!`.{!`!a.{!a!b.{!b!c.{!c!}.{#Q#R.{#R#S.{#S#T.{#T#o.{#p#q.{#r#s.{",tokenizers:[0],topRules:{Module:[0,3]},specialized:[{term:9,get:o=>S[o]||-1}],tokenPrec:0}),i=O.define({name:"wast",parser:Q.configure({props:[s.add({App:P({closing:")",align:!1})}),a.add({App:n,BlockComment(o){return{from:o.from+2,to:o.to-2}}}),t({Keyword:e.keyword,Type:e.typeName,Number:e.number,String:e.string,Identifier:e.variableName,LineComment:e.lineComment,BlockComment:e.blockComment,"( )":e.paren})]}),languageData:{commentTokens:{line:";;",block:{open:"(;",close:";)"}},closeBrackets:{brackets:["(",'"']}}});function p(){return new b(i)}export{p as wast,i as wastLanguage};
|
||||
import{b as O,d as b,L as r,f as s,g as a,s as t,j as P,l as n,t as e}from"./index-DiFBq1n1.js";const S={__proto__:null,anyref:34,dataref:34,eqref:34,externref:34,i31ref:34,funcref:34,i8:34,i16:34,i32:34,i64:34,f32:34,f64:34},Q=r.deserialize({version:14,states:"!^Q]QPOOOqQPO'#CbOOQO'#Cd'#CdOOQO'#Cl'#ClOOQO'#Ch'#ChQ]QPOOOOQO,58|,58|OxQPO,58|OOQO-E6f-E6fOOQO1G.h1G.h",stateData:"!P~O_OSPOSQOS~OTPOVROXROYROZROaQO~OSUO~P]OSXO~P]O",goto:"xaPPPPPPbPbPPPhPPPrXROPTVQTOQVPTWTVXSOPTV",nodeNames:"⚠ LineComment BlockComment Module ) ( App Identifier Type Keyword Number String",maxTerm:17,nodeProps:[["isolate",-3,1,2,11,""],["openedBy",4,"("],["closedBy",5,")"],["group",-6,6,7,8,9,10,11,"Expression"]],skippedNodes:[0,1,2],repeatNodeCount:1,tokenData:"0o~R^XY}YZ}]^}pq}rs!Stu#pxy'Uyz(e{|(j}!O(j!Q!R(s!R![*p!]!^.^#T#o.{~!SO_~~!VVOr!Srs!ls#O!S#O#P!q#P;'S!S;'S;=`#j<%lO!S~!qOZ~~!tRO;'S!S;'S;=`!};=`O!S~#QWOr!Srs!ls#O!S#O#P!q#P;'S!S;'S;=`#j;=`<%l!S<%lO!S~#mP;=`<%l!S~#siqr%bst%btu%buv%bvw%bwx%bz{%b{|%b}!O%b!O!P%b!P!Q%b!Q![%b![!]%b!^!_%b!_!`%b!`!a%b!a!b%b!b!c%b!c!}%b#Q#R%b#R#S%b#S#T%b#T#o%b#p#q%b#r#s%b~%giV~qr%bst%btu%buv%bvw%bwx%bz{%b{|%b}!O%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keyword:e.keyword,Type:e.typeName,Number:e.number,String:e.string,Identifier:e.variableName,LineComment:e.lineComment,BlockComment:e.blockComment,"( )":e.paren})]}),languageData:{commentTokens:{line:";;",block:{open:"(;",close:";)"}},closeBrackets:{brackets:["(",'"']}}});function p(){return new b(i)}export{p as wast,i as wastLanguage};
|
File diff suppressed because one or more lines are too long
4
web/dist/index.html
vendored
4
web/dist/index.html
vendored
@ -6,8 +6,8 @@
|
||||
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js"></script>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>LoLLMS WebUI</title>
|
||||
<script type="module" crossorigin src="/assets/index-Dk_fdEJ6.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-BRCY9Cdd.css">
|
||||
<script type="module" crossorigin src="/assets/index-DiFBq1n1.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-jd0TJS39.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
@ -1,8 +1,12 @@
|
||||
<template>
|
||||
<div :id="containerId" ref="container"></div>
|
||||
<div :id="containerId" ref="container" @click="handleContainerClick"></div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from 'vuex';
|
||||
import axios from 'axios';
|
||||
import ImageAlbumViewer from './ImageAlbumViewer.vue'; // Adjust path if needed
|
||||
|
||||
export default {
|
||||
name: 'DynamicUIRenderer',
|
||||
props: {
|
||||
@ -14,54 +18,285 @@ export default {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
// Removed discussion_id prop, as it will be in the HTML data attribute
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
containerId: `dynamic-ui-${this.instanceId}`
|
||||
containerId: `dynamic-ui-${this.instanceId}`,
|
||||
albumImages: [], // Store images for the album viewer
|
||||
albumViewerInstance: null, // To keep track of the mounted album component
|
||||
injectedStyleElements: [], // To keep track of injected styles for cleanup
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapState(['clientId']), // Map client_id from Vuex store
|
||||
},
|
||||
watch: {
|
||||
ui: {
|
||||
immediate: true,
|
||||
handler(newValue) {
|
||||
console.log(`UI prop changed for instance ${this.instanceId}:`, newValue);
|
||||
this.$nextTick(() => {
|
||||
this.renderContent();
|
||||
});
|
||||
handler(newValue, oldValue) {
|
||||
// Only re-render if the UI actually changed
|
||||
if (newValue !== oldValue || this.$refs.container?.innerHTML === '') {
|
||||
console.log(`UI prop changed for instance ${this.instanceId}`);
|
||||
this.$nextTick(() => {
|
||||
this.cleanupDynamicContent(); // Clean up previous dynamic elements before rendering new
|
||||
this.renderContent();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
beforeUnmount() {
|
||||
this.cleanupDynamicContent(); // Ensure cleanup when component is destroyed
|
||||
// Remove the main click listener
|
||||
this.$refs.container?.removeEventListener('click', this.handleContainerClick);
|
||||
},
|
||||
methods: {
|
||||
renderContent() {
|
||||
console.log(`Rendering content for instance ${this.instanceId}...`);
|
||||
const container = this.$refs.container;
|
||||
|
||||
// Parse the UI string
|
||||
if (!container) {
|
||||
console.error(`Container ref not found for instance ${this.instanceId}`);
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear previous content safely
|
||||
container.innerHTML = '';
|
||||
this.albumImages = []; // Reset album images
|
||||
|
||||
const parser = new DOMParser();
|
||||
const doc = parser.parseFromString(this.ui, 'text/html');
|
||||
|
||||
// Extract and inject CSS
|
||||
const styles = doc.getElementsByTagName('style');
|
||||
Array.from(styles).forEach(style => {
|
||||
const scopedStyle = document.createElement('style');
|
||||
scopedStyle.textContent = this.scopeCSS(style.textContent);
|
||||
document.head.appendChild(scopedStyle);
|
||||
|
||||
// --- 1. Inject Scoped CSS ---
|
||||
const styles = doc.head.getElementsByTagName('style'); // Check head first
|
||||
Array.from(styles).forEach(style => this.injectScopedCss(style.textContent));
|
||||
const bodyStyles = doc.body.getElementsByTagName('style'); // Also check body
|
||||
Array.from(bodyStyles).forEach(style => this.injectScopedCss(style.textContent));
|
||||
|
||||
// --- 2. Process HTML Body ---
|
||||
const processedNodes = [];
|
||||
let albumPlaceholderNeeded = false;
|
||||
|
||||
// Convert NodeList to Array for easier manipulation
|
||||
const nodesToProcess = Array.from(doc.body.childNodes);
|
||||
|
||||
nodesToProcess.forEach(node => {
|
||||
if (node.nodeType === Node.ELEMENT_NODE) {
|
||||
// --- Special Handling: Image Album ---
|
||||
if (node.tagName === 'IMG' && node.classList.contains('album')) {
|
||||
const src = node.getAttribute('src');
|
||||
if (src) {
|
||||
this.albumImages.push(src);
|
||||
albumPlaceholderNeeded = true;
|
||||
}
|
||||
// Don't add the original img.album node directly
|
||||
return; // Skip appending this node
|
||||
}
|
||||
|
||||
// --- Special Handling: Clickable Image POST ---
|
||||
// Use a specific class like 'clickable-post' and data attributes for flexibility
|
||||
// Example HTML: <img src="path/img.jpg" class="clickable-post" data-endpoint="/post_to_personality" data-payload-key="img_path">
|
||||
if (node.tagName === 'IMG' && node.classList.contains('clickable-post')) {
|
||||
// Add necessary data attributes if they were in onclick="post_to_personality"
|
||||
// This part is tricky if relying solely on onclick. Best practice is to use data attributes.
|
||||
// Assuming HTML is updated to use data attributes as shown above.
|
||||
if (!node.dataset.endpoint) node.dataset.endpoint = '/post_to_personality'; // Default endpoint if not set
|
||||
if (!node.dataset.payloadKey) node.dataset.payloadKey = 'img_path'; // Default payload key
|
||||
// The click handling will be done via event delegation (handleContainerClick)
|
||||
}
|
||||
|
||||
// --- Special Handling: Open Folder Link ---
|
||||
// Example HTML: <a href="#" class="open-folder" data-discussion-id="123">Open Folder</a>
|
||||
if (node.tagName === 'A' && node.classList.contains('open-folder')) {
|
||||
// Ensure it has the data-discussion-id attribute.
|
||||
// Click handling via event delegation.
|
||||
node.setAttribute('href', '#'); // Prevent navigation
|
||||
}
|
||||
}
|
||||
|
||||
// Add the node (original or potentially modified) to our list
|
||||
processedNodes.push(node);
|
||||
});
|
||||
|
||||
// Extract and inject HTML
|
||||
container.innerHTML = doc.body.innerHTML;
|
||||
|
||||
// Extract and execute JavaScript
|
||||
const scripts = doc.getElementsByTagName('script');
|
||||
Array.from(scripts).forEach(script => {
|
||||
const newScript = document.createElement('script');
|
||||
newScript.textContent = script.textContent;
|
||||
container.appendChild(newScript);
|
||||
|
||||
// --- 3. Add Album Placeholder if needed ---
|
||||
if (albumPlaceholderNeeded && this.albumImages.length > 0) {
|
||||
const albumPlaceholder = document.createElement('div');
|
||||
// Give it a unique ID for mounting the Vue component
|
||||
albumPlaceholder.id = `album-placeholder-${this.instanceId}`;
|
||||
container.appendChild(albumPlaceholder); // Add placeholder first
|
||||
}
|
||||
|
||||
// --- 4. Append Processed Standard HTML Nodes ---
|
||||
processedNodes.forEach(node => {
|
||||
// Need to import the node into the current document context before appending
|
||||
container.appendChild(document.adoptNode(node));
|
||||
});
|
||||
|
||||
|
||||
// --- 5. Mount Album Viewer Component ---
|
||||
if (albumPlaceholderNeeded && this.albumImages.length > 0) {
|
||||
this.mountAlbumViewer();
|
||||
}
|
||||
|
||||
// --- 6. Handle Original Scripts (Use with caution!) ---
|
||||
// Executing arbitrary scripts can be a security risk and might interfere
|
||||
// with Vue's reactivity or the event delegation. It's often better to
|
||||
// handle interactions via the defined patterns (classes/data attributes).
|
||||
// If absolutely necessary:
|
||||
// const scripts = doc.body.getElementsByTagName('script');
|
||||
// Array.from(scripts).forEach(script => {
|
||||
// try {
|
||||
// const newScript = document.createElement('script');
|
||||
// newScript.textContent = script.textContent; // Might need scoping adjustments
|
||||
// container.appendChild(newScript); // Scripts added this way often don't execute reliably or might execute in global scope
|
||||
// // For reliable execution, you might need Function constructor or eval, which is risky:
|
||||
// // try { new Function(script.textContent).call(window); } catch (e) { console.error("Error executing script:", e); }
|
||||
// } catch (e) {
|
||||
// console.error("Error processing script tag:", e)
|
||||
// }
|
||||
// });
|
||||
console.log(`Finished rendering for instance ${this.instanceId}.`);
|
||||
},
|
||||
|
||||
injectScopedCss(css) {
|
||||
const scopedCss = this.scopeCSS(css);
|
||||
const styleElement = document.createElement('style');
|
||||
styleElement.textContent = scopedCss;
|
||||
document.head.appendChild(styleElement);
|
||||
this.injectedStyleElements.push(styleElement); // Keep track for cleanup
|
||||
},
|
||||
|
||||
scopeCSS(css) {
|
||||
return css.replace(/([^\r\n,{}]+)(,(?=[^}]*{)|\s*{)/g, `#${this.containerId} $1$2`);
|
||||
// Basic scoping: prepend container ID to selectors not already scoped deeper
|
||||
// This regex is basic and might need refinement for complex CSS.
|
||||
// It tries to target selectors at the start of a rule block.
|
||||
return css.replace(/([^\r\n,{}]+)(,(?=[^}]*{)|\s*{)/g, (match, selector, suffix) => {
|
||||
// Avoid scoping pseudo-elements like ::before directly on the ID, scope the base selector instead
|
||||
// Avoid scoping keyframes, font-face etc.
|
||||
selector = selector.trim();
|
||||
if (selector.startsWith('@') || selector.startsWith(':') || selector.includes('#') || selector.includes('[')) {
|
||||
// Don't scope if it starts with @ (keyframes, media), is pseudo-element/class only, or already has an ID/attribute selector
|
||||
return match;
|
||||
}
|
||||
// Prepend the ID, handling multiple selectors separated by commas
|
||||
const scopedSelector = selector.split(',')
|
||||
.map(part => `#${this.containerId} ${part.trim()}`)
|
||||
.join(', ');
|
||||
return `${scopedSelector}${suffix}`;
|
||||
});
|
||||
},
|
||||
|
||||
mountAlbumViewer() {
|
||||
// Ensure placeholder exists
|
||||
const placeholder = document.getElementById(`album-placeholder-${this.instanceId}`);
|
||||
if (!placeholder) {
|
||||
console.error("Album placeholder not found!");
|
||||
return;
|
||||
}
|
||||
|
||||
// Create and mount the ImageAlbumViewer component
|
||||
const AlbumViewerComponent = Vue.extend(ImageAlbumViewer);
|
||||
this.albumViewerInstance = new AlbumViewerComponent({
|
||||
propsData: {
|
||||
images: this.albumImages
|
||||
}
|
||||
});
|
||||
this.albumViewerInstance.$mount(placeholder); // Mount it onto the placeholder element
|
||||
console.log(`Mounted ImageAlbumViewer for instance ${this.instanceId}`);
|
||||
},
|
||||
|
||||
handleContainerClick(event) {
|
||||
const target = event.target;
|
||||
|
||||
// --- Handle Clickable Image Post ---
|
||||
const clickablePost = target.closest('img.clickable-post');
|
||||
if (clickablePost && clickablePost.dataset.endpoint) {
|
||||
event.preventDefault();
|
||||
const endpoint = clickablePost.dataset.endpoint;
|
||||
const payloadKey = clickablePost.dataset.payloadKey || 'img_path'; // Default key
|
||||
const src = clickablePost.getAttribute('src');
|
||||
const payload = { [payloadKey]: src };
|
||||
|
||||
console.log(`Posting to ${endpoint} with payload:`, payload);
|
||||
axios.post(endpoint, payload)
|
||||
.then(response => {
|
||||
console.log('Post successful:', response.data);
|
||||
// Optionally handle success (e.g., show message, update UI)
|
||||
})
|
||||
.catch(error => {
|
||||
console.error(`Error posting to ${endpoint}:`, error);
|
||||
// Optionally handle error
|
||||
});
|
||||
return; // Stop further processing if handled
|
||||
}
|
||||
|
||||
// --- Handle Open Folder Link ---
|
||||
const openFolderLink = target.closest('a.open-folder');
|
||||
if (openFolderLink && openFolderLink.dataset.discussionId) {
|
||||
event.preventDefault();
|
||||
const discussionId = openFolderLink.dataset.discussionId;
|
||||
if (!this.clientId) {
|
||||
console.error("Client ID not found in Vuex store.");
|
||||
alert("Error: Client information is missing.");
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(`Posting to /open_discussion_folder with client_id: ${this.clientId}, discussion_id: ${discussionId}`);
|
||||
axios.post('/open_discussion_folder', { client_id: this.clientId, discussion_id: discussionId })
|
||||
.then(response => {
|
||||
console.log('Open folder request successful:', response.data);
|
||||
// Handle success (maybe response indicates folder opened)
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error opening folder:', error);
|
||||
// Handle error (e.g., show error message)
|
||||
});
|
||||
return; // Stop further processing
|
||||
}
|
||||
|
||||
// Add more delegated event handlers here if needed...
|
||||
},
|
||||
|
||||
cleanupDynamicContent() {
|
||||
console.log(`Cleaning up dynamic content for instance ${this.instanceId}`);
|
||||
// Unmount and destroy the album viewer Vue instance if it exists
|
||||
if (this.albumViewerInstance) {
|
||||
try {
|
||||
this.albumViewerInstance.$destroy();
|
||||
// Remove the placeholder or container element if needed, check if $el exists first
|
||||
if (this.albumViewerInstance.$el && this.albumViewerInstance.$el.parentNode) {
|
||||
this.albumViewerInstance.$el.parentNode.removeChild(this.albumViewerInstance.$el);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Error destroying album viewer instance:", e);
|
||||
}
|
||||
this.albumViewerInstance = null;
|
||||
}
|
||||
|
||||
// Remove injected stylesheets
|
||||
this.injectedStyleElements.forEach(styleElement => {
|
||||
if (styleElement.parentNode) {
|
||||
styleElement.parentNode.removeChild(styleElement);
|
||||
}
|
||||
});
|
||||
this.injectedStyleElements = [];
|
||||
|
||||
// Clear container content (already done at the start of renderContent, but good practice)
|
||||
const container = this.$refs.container;
|
||||
if (container) {
|
||||
// container.innerHTML = ''; // Be careful if renderContent is called immediately after
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* Add any styles specific to the container itself, if needed */
|
||||
/* For example: */
|
||||
/* div[id^="dynamic-ui-"] {
|
||||
border: 1px dashed lightgray;
|
||||
padding: 5px;
|
||||
margin-bottom: 10px;
|
||||
} */
|
||||
</style>
|
Loading…
x
Reference in New Issue
Block a user