Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sever err: Client.Timeout #320

Closed
ddkwork opened this issue Mar 12, 2024 · 1 comment
Closed

sever err: Client.Timeout #320

ddkwork opened this issue Mar 12, 2024 · 1 comment
Assignees
Labels
ai Cogent AI bug Something isn't working

Comments

@ddkwork
Copy link
Contributor

ddkwork commented Mar 12, 2024

Describe the bug

This is a problem that has been bothering me for a long time, and I can't reproduce it every time, judging by the scan result of the body, the model closes the connection before it has returned the entire content

How to reproduce

GOROOT=C:\Program Files\Go #gosetup
GOPATH=C:\Users\Admin\go #gosetup
"C:\Program Files\Go\bin\go.exe" build -o C:\Users\Admin\AppData\Local\JetBrains\GoLand2023.3\tmp\GoLand\___2go_build_cogentcore_org_cogent_ai.exe cogentcore.org/cogent/ai #gosetup
[2024-03-12 16:46:46]   Trace ->  --------- title --------- | ------------------ info ------------------ //runtime.doInit1+0xec C:/Program Files/Go/src/runtime/proc.go:7176
[2024-03-12 16:46:49]   Error ->                            | textField.Text() == "" //main.main.func11+0x94 C:/Users/Admin/Desktop/cogent/ai/ai.go:90
[2024-03-12 16:51:36] Warning ->              connect serve | Send "how to use goquery get \"instruct\"\r\n\r\n              <div class=\"flex px-4 py-3\">\r\n                <div class=\"flex-1\">\r\n                  <a class=\"group\" href=\"/library/gemma:instruct\">\r\n                    <div class=\"break-all font-medium text-gray-900 group-hover:underline\">instruct</div>\r\n                    <div class=\"flex items-baseline space-x-1 text-[13px] text-neutral-500\">\r\n                      <span>\r\n                        430ed3535049 • 5.2GB • \r\n                        Updated 2 weeks ago\r\n                      </span>\r\n                    </div>\r\n                  </a>\r\n                </div>\r\n                \r\n              </div> " to the serve,please wait a while //main.main.func11.1+0xc9 C:/Users/Admin/Desktop/cogent/ai/ai.go:94
Sure, here's how you can use `goquery` to get the text "instruct":

```go
import (
  "github.com/goquery/goquery"
)

// Get the HTML content from the URL
data, err := goquery.New("your_url").HTML()

// If there's an error, handle it
if err != nil {
  panic(err)
}

// Parse the HTML content
results, err := goquery.Parse(data)

// If there's an error, handle it
if err != nil {
  panic(err)
}

// Get the first match of the element with the class "instruct"
result := results.Find("a.group[href='/library/gemma:instruct']")

// If we found the element, extract the text
if result != nil {
  text := result.Text()
  fmt.Println(text) // Output: instruct
} else {
  // If we didn't find the element, handle it
  fmt[2024-03-12 16:53:36]   Error ->                            | read tcp 127.0.0.1:64342->127.0.0.1:11434: use of closed network connection (Client.Timeout or context cancellation while reading body) //main.main.func11.1+0x4b3 C:/Users/Admin/Desktop/cogent/ai/ai.go:131

Example code

No response

Relevant output

No response

Platform

Windows

@ddkwork ddkwork added the bug Something isn't working label Mar 12, 2024
@ddkwork
Copy link
Contributor Author

ddkwork commented Mar 12, 2024

One guess as to a possible solution is to set a timeout on the client, but I haven't found where to set it there yet

@ddkwork ddkwork closed this as not planned Won't fix, can't repro, duplicate, stale Mar 15, 2024
@kkoreilly kkoreilly reopened this Mar 15, 2024
@ddkwork ddkwork changed the title ai sever err: Client.Timeout sever err: Client.Timeout Mar 16, 2024
@ddkwork ddkwork added the ai Cogent AI label Mar 16, 2024
@ddkwork ddkwork self-assigned this Mar 16, 2024
ddkwork added a commit that referenced this issue Mar 16, 2024
ddkwork added a commit that referenced this issue Mar 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ai Cogent AI bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants