Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit188f9cb

Browse files
iamfaranraheeliftikhar5
authored andcommitted
setup http streaming with dummy data
1 parent4664b5b commit188f9cb

File tree

1 file changed

+15
-34
lines changed

1 file changed

+15
-34
lines changed

‎client/packages/lowcoder/src/comps/queries/httpQuery/sseHttpQuery.tsx‎

Lines changed: 15 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export class SseHttpQuery extends SseHttpTmpQuery {
112112
constprocessedParams=this.processParameters(params,props);
113113

114114
// Build request from processed parameters
115-
const{ url, headers, method, body}=this.buildRequestFromParams(processedParams);
115+
const{ url, headers, method, body}=this.buildRequestFromParams(processedParams,props.args);
116116

117117
// Execute streaming logic
118118
if(method==="GET"){
@@ -151,41 +151,23 @@ export class SseHttpQuery extends SseHttpTmpQuery {
151151
];
152152
}
153153

154-
privatebuildRequestFromParams(processedParams:Array<{key:string,value:any}>){
155-
debugger;
156-
constparamMap=newMap(processedParams.map(p=>[p.key,p.value]));
157-
158-
// Extract URL
159-
constbaseUrl=paramMap.get('path')||'';
160-
consturl=newURL(baseUrl);
161-
162-
// Add query parameters
163-
Object.entries(paramMap).forEach(([key,value])=>{
164-
if(key.startsWith('params.')&&key.endsWith('.value')){
165-
constparamName=key.replace('params.','').replace('.value','');
166-
if(value)url.searchParams.append(paramName,String(value));
167-
}
168-
});
169-
170-
// Build headers
171-
constheaders:Record<string,string>={};
172-
Object.entries(paramMap).forEach(([key,value])=>{
173-
if(key.startsWith('headers.')&&key.endsWith('.value')){
174-
constheaderName=key.replace('headers.','').replace('.value','');
175-
if(value)headers[headerName]=String(value);
176-
}
154+
privatebuildRequestFromParams(processedParams:Array<{key:string,value:any}>,args:Record<string,unknown>={}){
155+
// Hardcoded values from the screenshot for testing
156+
consturl="http://localhost:11434/api/generate";
157+
constheaders={
158+
"Content-Type":"application/json",
159+
"Accept":"text/event-stream"
160+
};
161+
constmethod="POST";
162+
constbody=JSON.stringify({
163+
"model":"gemma3",
164+
"prompt":"Tell me a short story about a robot",
165+
"stream":true
177166
});
178167

179-
// Get method and body
180-
constmethod=paramMap.get('httpMethod')||'GET';
181-
constbodyType=paramMap.get('bodyType');
182-
letbody:string|FormData|undefined;
168+
console.log("Hardcoded request:",{ url, headers, method, body});
183169

184-
if(bodyType==='application/json'||bodyType==='text/plain'){
185-
body=paramMap.get('body')asstring;
186-
}
187-
188-
return{url:url.toString(), headers, method, body};
170+
return{ url, headers, method, body};
189171
}
190172

191173
privateasynchandleEventSource(
@@ -239,7 +221,6 @@ export class SseHttpQuery extends SseHttpTmpQuery {
239221
headers:{
240222
...headers,
241223
'Accept':'text/event-stream',
242-
'Cache-Control':'no-cache',
243224
},
244225
body,
245226
signal:this.controller.signal,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp