#FINISHED
52 messages · Page 1 of 1 (latest)
that's just a snippet btw
make is for making arrays, are you tryin to make an array of length 0.1?
yeah pretty muchs
What does that mean
sorry, i'm beginner
0.1 elements?
look i'll be honest
literally no idea haha
when i switched it to 1 from 16 it made my code go faster
What are you tryign to do?
Again, what are you tryin to do
it's a fork of another program
i just said?
it's to forward requests faster
I mean with this chunk := make([]byte, 0.1)
im trying to set that to 0.1
when I do my build fails
1 works fine
sorry if i'm confusing
make makes arrays, you supply the type and the length
An array of length 0.1 doesn't make sense
huh
thanks
here
i'll just give you the whole thing
if !original_request.Stream {
// Get response body
fulltext, err := io.ReadAll(response.Body)
if err != nil {
c.JSON(500, gin.H{
"error": "error reading response",
})
return
}
// Set response type to json
c.Header("Content-Type", "application/json")
full_response := responses.NewChatCompletion(string(fulltext))
if err != nil {
return
}
c.JSON(200, full_response)
return
} else {
// Set response type to text/event-stream
c.Header("Content-Type", "text/event-stream")
// Reader
reader := bufio.NewReader(response.Body)
// Loop through the response
for {
chunk := make([]byte, 0.1)
n, err := reader.Read(chunk)
if err != nil {
if err == io.EOF {
break
}
c.JSON(500, gin.H{
"error": "error reading response",
})
return
}
// Convert chunk to string
chunk_string := string(chunk[:n])
// Convert chunk to json string
json_string, err := json.Marshal(responses.NewChatCompletionChunk(chunk_string))
if err != nil {
c.JSON(500, gin.H{
"error": "error converting response",
})
return
}
c.String(200, "data: "+string(json_string)+"\n\n")
}
}
c.String(200, "data: [DONE]")
}
sorry, i'm really beginner as stated by the tag
What is your question again?
Okay but why?
You can't make an array with 0.1 elements, it's doesn't make sense
the code went faster
it's actually impossible?
You know what an array is?
nope!
._.