Optimize Agent Flow Runner and improve Video Streaming
This commit is contained in:
Binary file not shown.
@@ -150,11 +150,17 @@ export class ExecutionContext {
|
||||
// Support nested access: temp.server.virtualserver_clientsonline
|
||||
const firstDot = dotPath.indexOf('.');
|
||||
if (firstDot === -1) {
|
||||
value = String(this.tempVars.get(dotPath) ?? '');
|
||||
const raw = this.tempVars.get(dotPath);
|
||||
// If value is an object/array, serialize as JSON so {{temp.apiResult}} returns valid JSON text
|
||||
value = raw == null ? '' : (typeof raw === 'object' ? JSON.stringify(raw) : String(raw));
|
||||
} else {
|
||||
const topKey = dotPath.substring(0, firstDot);
|
||||
const rest = dotPath.substring(firstDot + 1);
|
||||
const topVal = this.tempVars.get(topKey);
|
||||
let topVal = this.tempVars.get(topKey);
|
||||
// If stored as JSON string (e.g. from HTTP response), parse it for dot access
|
||||
if (typeof topVal === 'string') {
|
||||
try { topVal = JSON.parse(topVal); } catch { /* not JSON */ }
|
||||
}
|
||||
const resolved = resolveDotPath(topVal, rest);
|
||||
value = resolved != null ? String(resolved) : '';
|
||||
}
|
||||
|
||||
@@ -452,7 +452,16 @@ export class FlowRunner {
|
||||
transformResponse: [(data) => data], // Return raw response, don't auto-parse JSON
|
||||
});
|
||||
if (data.storeAs) {
|
||||
ctx.setTemp(data.storeAs, response.data);
|
||||
// Try to parse JSON so nested dot-access (e.g. {{temp.apiResult.field}}) works
|
||||
let stored: any = response.data;
|
||||
if (typeof stored === 'string') {
|
||||
try {
|
||||
stored = JSON.parse(stored);
|
||||
} catch {
|
||||
// Not JSON — keep as plain string
|
||||
}
|
||||
}
|
||||
ctx.setTemp(data.storeAs, stored);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -953,6 +953,10 @@ export default function BotEditor() {
|
||||
<Label className="text-[10px] text-muted-foreground">Channel Topic</Label>
|
||||
<Input className="h-7 text-xs mt-1" placeholder="Optional" value={selectedNodeData.config.channel_topic || ''} onChange={(e) => setNodes((prev) => prev.map((n) => n.id === selectedNode ? { ...n, config: { ...n.config, channel_topic: e.target.value } } : n))} />
|
||||
</div>
|
||||
<div>
|
||||
<Label className="text-[10px] text-muted-foreground">Channel Description</Label>
|
||||
<Textarea className="text-xs mt-1 min-h-[60px] font-mono-data" placeholder="{{temp.apiResult}}" value={selectedNodeData.config.channel_description || ''} onChange={(e) => setNodes((prev) => prev.map((n) => n.id === selectedNode ? { ...n, config: { ...n.config, channel_description: e.target.value } } : n))} />
|
||||
</div>
|
||||
<div>
|
||||
<Label className="text-[10px] text-muted-foreground">Channel Password (optional)</Label>
|
||||
<Input
|
||||
|
||||
@@ -507,7 +507,6 @@ func (s *Sidecar) StartFFmpeg(source string) {
|
||||
|
||||
w := envIntOrDefault("VIDEO_WIDTH", 1280)
|
||||
h := envIntOrDefault("VIDEO_HEIGHT", 720)
|
||||
fps := envOrDefault("VIDEO_FRAMERATE", "30")
|
||||
vBitrate := envOrDefault("VIDEO_BITRATE", "1500k")
|
||||
|
||||
if source != "" {
|
||||
@@ -515,7 +514,7 @@ func (s *Sidecar) StartFFmpeg(source string) {
|
||||
args = append(args,
|
||||
"-map", "0:v:0",
|
||||
"-vf", vf,
|
||||
"-r", fps,
|
||||
"-vsync", "passthrough",
|
||||
)
|
||||
}
|
||||
args = append(args,
|
||||
|
||||
Reference in New Issue
Block a user