cogentcore / core

A free and open source framework for building powerful, fast, and elegant 2D and 3D apps that run on macOS, Windows, Linux, iOS, Android, and the Web with a single pure Go codebase, allowing you to Code Once, Run Everywhere.
http://cogentcore.org/core
BSD 3-Clause "New" or "Revised" License
1.32k stars 71 forks source link

markdown sync #929

Closed ddkwork closed 3 months ago

ddkwork commented 4 months ago

Describe the feature

After some testing, Label doesn't seem to be suitable for AI chat scenarios, while Markdown does, almost all AI models return MD format, CoreDOM doesn't seem to have a way to insert text in threads, can you add this feature?

Relevant code

package main

import (
    "cogentcore.org/core/gi"
    "fmt"
    "math/rand"
    "time"
    "unsafe"
)

func main() {
    b := gi.NewBody("ollama gui")
    label := gi.NewLabel(b)
    go func() {
        orig := "orig "
        for i := 0; i < 30000; i++ {
            start := label.UpdateStart()
            s := orig + randStr(i) + fmt.Sprint(i)
            if len(s)%10 == 0 {
                s += "\n"
            }
            label.SetTextUpdate(s)
            label.UpdateEndLayout(start)
            time.Sleep(200 * time.Millisecond)
        }
    }()
    b.RunMainWindow()
}

// ////////
const letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"

var src = rand.NewSource(time.Now().UnixNano())

const (
    // 6 bits to represent a letter index
    letterIdBits = 6
    // All 1-bits as many as letterIdBits
    letterIdMask = 1<<letterIdBits - 1
    letterIdMax  = 63 / letterIdBits
)

func randStr(n int) string {
    b := make([]byte, n)
    // A rand.Int63() generates 63 random bits, enough for letterIdMax letters!
    for i, cache, remain := n-1, src.Int63(), letterIdMax; i >= 0; {
        if remain == 0 {
            cache, remain = src.Int63(), letterIdMax
        }
        if idx := int(cache & letterIdMask); idx < len(letters) {
            b[i] = letters[idx]
            i--
        }
        cache >>= letterIdBits
        remain--
    }
    return *(*string)(unsafe.Pointer(&b))
}
kkoreilly commented 3 months ago

I can tell you how to do it, but another option is that we could move it to https://github.com/cogentcore/cogent as Cogent AI, which would make it easier for me to contribute to it and would ensure that we continue to maintain it. I would then give you write access to cogent.

ddkwork commented 3 months ago

how to set write access to the repository for you?

ddkwork commented 3 months ago

Ok

---Original--- From: @.> Date: Sun, Mar 10, 2024 03:50 AM To: @.>; Cc: @.**@.>; Subject: Re: [cogentcore/core] markdown sync (Issue #929)

I can tell you how to do it, but another option is that we could move it to https://github.com/cogentcore/cogent as Cogent AI, which would make it easier for me to contribute to it and would ensure that we continue to maintain it. I would then give you write access to cogent.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

kkoreilly commented 3 months ago

Okay, I will move it to Cogent with the token streaming working now.

kkoreilly commented 3 months ago

I moved to Cogent in the ai directory and invited you as a write access contributor to the repository. Please only modify the ai directory for now, and do not import any of your third-party libraries. You should move all of the logic you need into the ai directory itself. We do not need logging packages right now.

kkoreilly commented 3 months ago

Also, you should not need any large files or custom icons for now.

ddkwork commented 3 months ago

Ok

ddkwork commented 3 months ago

I'm getting interrupted by this every time I test the layout, can you fix it first?

Crash log saved in C:\Users\Administrator\AppData\Roaming\Cogent AI\crash-logs

Platform: Windows
System platform: Windows
App version: dev
Core version: dev
Time: 2024-03-10 04:34:10

panic: interface conversion: interface is nil, not gi.Widget

goroutine 14 [running]:
runtime/debug.Stack()
    C:/Program Files/Go/src/runtime/debug/stack.go:24 +0x5e
cogentcore.org/core/gi.HandleRecover({0x7ff70a6eb8c0, 0xc00298d170})
    C:/Users/Administrator/go/pkg/mod/cogentcore.org/core@v0.0.8-0.20240309010543-9eb35d11ca28/gi/recover.go:37 +0x6c
cogentcore.org/core/gi.(*RenderWin).EventLoop.func1()
    C:/Users/Administrator/go/pkg/mod/cogentcore.org/core@v0.0.8-0.20240309010543-9eb35d11ca28/gi/renderwin.go:544 +0x24
panic({0x7ff70a6eb8c0?, 0xc00298d170?})
    C:/Program Files/Go/src/runtime/panic.go:770 +0x132
cogentcore.org/core/gi.(*WidgetBase).OnInit.(*WidgetBase).SetStyles.func1(0xc000ceb650)
    C:/Users/Administrator/go/pkg/mod/cogentcore.org/core@v0.0.8-0.20240309010543-9eb35d11ca28/gi/style.go:148 +0x39b
cogentcore.org/core/gi.(*WidgetBase).RunStylers(0xc000ceb508)
    C:/Users/Administrator/go/pkg/mod/cogentcore.org/core@v0.0.8-0.20240309010543-9eb35d11ca28/gi/style.go:167 +0xa2
cogentcore.org/core/gi.(*WidgetBase).ApplyStyleWidget(0xc000ceb508)
    C:/Users/Administrator/go/pkg/mod/cogentcore.org/core@v0.0.8-0.20240309010543-9eb35d11ca28/gi/style.go:93 +0x8f
cogentcore.org/core/giv.(*TreeView).ApplyStyle(0xc000ceb508)
    C:/Users/Administrator/go/pkg/mod/cogentcore.org/core@v0.0.8-0.20240309010543-9eb35d11ca28/giv/treeview.go:515 +0x7c
cogentcore.org/core/giv.(*TreeView).SetStyles.func2.4({0x7ff70bd35838, 0xc0028aeb60})
    C:/Users/Administrator/go/pkg/mod/cogentcore.org/core@v0.0.8-0.20240309010543-9eb35d11ca28/giv/treeview.go:277 +0x56
cogentcore.org/core/events.(*Listeners).Call(0xc001086878, {0x7ff70bd35838, 0xc0028aeb60}, {0xc0000459e0, 0x1, 0x7ff70971f9ba?})
    C:/Users/Administrator/go/pkg/mod/cogentcore.org/core@v0.0.8-0.20240309010543-9eb35d11ca28/events/listeners.go:52 +0xfd
cogentcore.org/core/gi.(*WidgetBase).HandleEvent(0xc001086008, {0x7ff70bd35838, 0xc0028aeb60})
    C:/Users/Administrator/go/pkg/mod/cogentcore.org/core@v0.0.8-0.20240309010543-9eb35d11ca28/gi/events.go:254 +0x1ad
cogentcore.org/core/gi.(*WidgetBase).Send(0xc001086008, 0xc, {0xc000e170a0?, 0x7ff70a693cc0?, 0x1?})
    C:/Users/Administrator/go/pkg/mod/cogentcore.org/core@v0.0.8-0.20240309010543-9eb35d11ca28/gi/events.go:190 +0xb7
cogentcore.org/core/gi.(*EventMgr).UpdateHovers(0x7ff70bd355b8?, {0xc000435110, 0x3, 0xd}, {0xc0004345b0, 0x3, 0x1?}, {0x7ff70bd355b8, 0xc003a987e0}, 0xb, ...)
    C:/Users/Administrator/go/pkg/mod/cogentcore.org/core@v0.0.8-0.20240309010543-9eb35d11ca28/gi/eventmgr.go:496 +0x14e
cogentcore.org/core/gi.(*EventMgr).HandlePosEvent(0xc0002d4a50, {0x7ff70bd355b8, 0xc003a987e0})
    C:/Users/Administrator/go/pkg/mod/cogentcore.org/core@v0.0.8-0.20240309010543-9eb35d11ca28/gi/eventmgr.go:348 +0x1831
cogentcore.org/core/gi.(*EventMgr).HandleEvent(0xc0002d4a50, {0x7ff70bd355b8, 0xc003a987e0})
    C:/Users/Administrator/go/pkg/mod/cogentcore.org/core@v0.0.8-0.20240309010543-9eb35d11ca28/gi/eventmgr.go:159 +0x5a
cogentcore.org/core/gi.(*Stage).MainHandleEvent(0xc00022e248, {0x7ff70bd355b8, 0xc003a987e0})
    C:/Users/Administrator/go/pkg/mod/cogentcore.org/core@v0.0.8-0.20240309010543-9eb35d11ca28/gi/mainstage.go:348 +0x165
cogentcore.org/core/gi.(*StageMgr).MainHandleEvent(0xc00069c038, {0x7ff70bd355b8, 0xc003a987e0})
    C:/Users/Administrator/go/pkg/mod/cogentcore.org/core@v0.0.8-0.20240309010543-9eb35d11ca28/gi/mainstage.go:356 +0x6e
cogentcore.org/core/gi.(*RenderWin).HandleEvent(0xc00069c000, {0x7ff70bd355b8, 0xc003a987e0})
    C:/Users/Administrator/go/pkg/mod/cogentcore.org/core@v0.0.8-0.20240309010543-9eb35d11ca28/gi/renderwin.go:597 +0x15e
cogentcore.org/core/gi.(*RenderWin).EventLoop(0xc00069c000)
    C:/Users/Administrator/go/pkg/mod/cogentcore.org/core@v0.0.8-0.20240309010543-9eb35d11ca28/gi/renderwin.go:558 +0x125
created by cogentcore.org/core/gi.(*RenderWin).GoStartEventLoop in goroutine 1
    C:/Users/Administrator/go/pkg/mod/cogentcore.org/core@v0.0.8-0.20240309010543-9eb35d11ca28/gi/renderwin.go:512 +0xa5
kkoreilly commented 3 months ago

Yep, I can reproduce this and will work on fixing it.

ddkwork commented 3 months ago

In the case of MD dynamic fill, the scale setting of the split layout of the right view seems to work, do you know what the reason is? When there are enough rows in the MD, the new topic and input boxes and the send button are squeezed to the bottom and are out of sight, and the horizontal scrollbar of the MD is visible, but the vertical scrollbar is not controlled by the split layout

---Original--- From: @.> Date: Sun, Mar 10, 2024 04:38 AM To: @.>; Cc: @.**@.>; Subject: Re: [cogentcore/core] markdown sync (Issue #929)

Yep, I can reproduce this and will work on fixing it.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

ddkwork commented 3 months ago

Also, in order to get the latest list of models for ollama, I had to bring in a third-party html dom parsing library, do you have a better way to parse? https://github.com/PuerkitoBio/goquery

---Original--- From: @.> Date: Sun, Mar 10, 2024 04:38 AM To: @.>; Cc: @.**@.>; Subject: Re: [cogentcore/core] markdown sync (Issue #929)

Yep, I can reproduce this and will work on fixing it.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

kkoreilly commented 3 months ago

Yep, it is fine to use that. I just don't want you to use GUI helper libraries that hide what core is actually doing, but libraries for necessary non-GUI functionality like model fetching are perfectly fine.

ddkwork commented 3 months ago

Ok

---Original--- From: @.> Date: Sun, Mar 10, 2024 05:02 AM To: @.>; Cc: @.**@.>; Subject: Re: [cogentcore/core] markdown sync (Issue #929)

Yep, it is fine to use that. I just don't want you to use GUI helper libraries that hide what core is actually doing, but libraries for necessary non-GUI functionality like model fetching are perfectly fine.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

kkoreilly commented 3 months ago

I fixed the panic in the latest version of core; it should not panic now if you are using a workspace containing both cogent and core.

ddkwork commented 3 months ago

Ok

---Original--- From: @.> Date: Sun, Mar 10, 2024 05:10 AM To: @.>; Cc: @.**@.>; Subject: Re: [cogentcore/core] markdown sync (Issue #929)

I fixed the panic in the latest version of core; it should not panic now if you are using a workspace containing both cogent and core.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

ddkwork commented 3 months ago

Hi, the slice view of the model in the left view feels weird, do you have time to take a look?

kkoreilly commented 3 months ago

I made it so that it uses a table view, which looks better. You could also consider making it just display the description as a tooltip and only show the names to make the layout cleaner and simpler. To do that, you would make a slice of strings from the slice of models and then make a slice view from that.

ddkwork commented 3 months ago

ok

---Original--- From: @.> Date: Sun, Mar 10, 2024 13:09 PM To: @.>; Cc: @.**@.>; Subject: Re: [cogentcore/core] markdown sync (Issue #929)

I made it so that it uses a table view, which looks better. You could also consider making it just display the description as a tooltip and only show the names to make the layout cleaner and simpler. To do that, you would make a slice of strings from the slice of models and then make a slice view from that.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

ddkwork commented 3 months ago

After adding the model tags, there are multiple versions of a model, and then I feel that I still have to have a tree view to accommodate many tags

---Original--- From: @.> Date: Sun, Mar 10, 2024 13:09 PM To: @.>; Cc: @.**@.>; Subject: Re: [cogentcore/core] markdown sync (Issue #929)

I made it so that it uses a table view, which looks better. You could also consider making it just display the description as a tooltip and only show the names to make the layout cleaner and simpler. To do that, you would make a slice of strings from the slice of models and then make a slice view from that.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

kkoreilly commented 3 months ago

I am fine with a tree view, but you could also have two separate views in splits: one for the model and one for the tags.

ddkwork commented 3 months ago

Okay, let's solve the last layout model and introduce the client code, MD displays multiple lines and then squeezes the message input box below to the bottom, it is invisible, how to make the view area in the lower right corner always exist

---Original--- From: @.> Date: Sun, Mar 10, 2024 13:13 PM To: @.>; Cc: @.**@.>; Subject: Re: [cogentcore/core] markdown sync (Issue #929)

I am fine with a tree view, but you could also have two separate views in splits: one for the model and one for the tags.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

kkoreilly commented 3 months ago

Yes, I am going to try to get the layout working well now.

kkoreilly commented 3 months ago

I improved the layout setup, and the main thing missing now is automatic scrolling to the end. I am thinking about how to implement that now.

ddkwork commented 3 months ago

yes, that's why I had it scroll to the bottom of the previous sync demo, and we were going to watch the latest output in real time

---Original--- From: @.> Date: Sun, Mar 10, 2024 13:27 PM To: @.>; Cc: @.**@.>; Subject: Re: [cogentcore/core] markdown sync (Issue #929)

I improved the layout setup, and the main thing missing now is automatic scrolling to the end. I am thinking about how to implement that now.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

ddkwork commented 3 months ago

I think all of these big data collection types of widgets can add a scroll to the bottom for them, and it's better to add them to the interface so that all of these types of widgets have this functionality

ddkwork commented 3 months ago

I've looked at the client's response handling for a while, and it seems that only the channel is suitable, is there a better way? You refresh my commit to see the todo traversing token there

kkoreilly commented 3 months ago

The app does not compile for me:

# github.com/bogdanfinn/tls-client/profiles
../../../go/pkg/mod/github.com/bogdanfinn/tls-client@v1.6.1/profiles/contributed_custom_profiles.go:264:11: undefined: tls.ALPSExtension
../../../go/pkg/mod/github.com/bogdanfinn/tls-client@v1.6.1/profiles/internal_browser_profiles.go:59:11: undefined: tls.ALPSExtension
../../../go/pkg/mod/github.com/bogdanfinn/tls-client@v1.6.1/profiles/internal_browser_profiles.go:517:7: unknown field AlgorithmsSignature in struct literal of type "github.com/bogdanfinn/utls".FakeDelegatedCredentialsExtension
ddkwork commented 3 months ago

I've noticed that the current MD rendering mode is like the Instant Mode UI, which can affect performance in contexts where the AI replies too long. I'm running the smallest model now, if there's a high-spec machine running a very large model like 70b and at the same time adding the code that we've stuffed into an entire repository for it to handle, when that happens, I'm not sure if the AI will reply to us in segments, if it's segmented, how do we save it, and if not, it might get stuck every time we render more than 1-5MB or so of MD text from a new one. It's a shame I didn't have this kind of high-profile machine to test it, and I didn't have an in-depth understanding of the server's response mechanism and parameters, control methods, and so on. Assuming that the above scenario happens, then we need to add a cache field to the md widget and execute this logic in the event callback function of md adding new rows: traversing the rows that exist and determining whether the flags need to recalculate the rendering process for layout, style, etc., and then render the new lines if not, etc. However, the implementation I saw in the unison repository also re-rendered everything, but I didn't look into the details of caching processing

---Original--- From: @.> Date: Sun, Mar 10, 2024 14:31 PM To: @.>; Cc: @.**@.>; Subject: Re: [cogentcore/core] markdown sync (Issue #929)

The app does not compile for me:

github.com/bogdanfinn/tls-client/profiles ..@./profiles/contributed_custom_profiles.go:264:11: undefined: tls.ALPSExtension ..@./profiles/internal_browser_profiles.go:59:11: undefined: tls.ALPSExtension ..@.***/profiles/internal_browser_profiles.go:517:7: unknown field AlgorithmsSignature in struct literal of type "github.com/bogdanfinn/utls".FakeDelegatedCredentialsExtension

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

ddkwork commented 3 months ago

wait me fix

---Original--- From: @.> Date: Sun, Mar 10, 2024 14:31 PM To: @.>; Cc: @.**@.>; Subject: Re: [cogentcore/core] markdown sync (Issue #929)

The app does not compile for me:

github.com/bogdanfinn/tls-client/profiles ..@./profiles/contributed_custom_profiles.go:264:11: undefined: tls.ALPSExtension ..@./profiles/internal_browser_profiles.go:59:11: undefined: tls.ALPSExtension ..@.***/profiles/internal_browser_profiles.go:517:7: unknown field AlgorithmsSignature in struct literal of type "github.com/bogdanfinn/utls".FakeDelegatedCredentialsExtension

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

ddkwork commented 3 months ago

try again

---Original--- From: @.> Date: Sun, Mar 10, 2024 14:31 PM To: @.>; Cc: @.**@.>; Subject: Re: [cogentcore/core] markdown sync (Issue #929)

The app does not compile for me:

github.com/bogdanfinn/tls-client/profiles ..@./profiles/contributed_custom_profiles.go:264:11: undefined: tls.ALPSExtension ..@./profiles/internal_browser_profiles.go:59:11: undefined: tls.ALPSExtension ..@.***/profiles/internal_browser_profiles.go:517:7: unknown field AlgorithmsSignature in struct literal of type "github.com/bogdanfinn/utls".FakeDelegatedCredentialsExtension

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

ddkwork commented 3 months ago

All the todo's within the ai file list the problems I'm having, libraries such as xe aren't executing the correct commands and there aren't any error logs, can't see what's going on, I'll be debugging the issue of starting the communication between the server and client by calling my own libs within my original repository, also, is it possible for parts of things to be renamed to their shorthand? As long as I don't use it too often, once I do I have to dig through a list of methods or field names for a while to find it!

ddkwork commented 3 months ago

screenshots

ddkwork commented 3 months ago

For some reason sync seems to block the http io, then I refer it to channel operations and it still blocks. Also, can I use my own logging package? Your logging packages and troubleshooting functions don't really work for me.

kkoreilly commented 3 months ago

The current way I implemented MD rendering is not super high performance, and I have an idea of how to improve the performance, and I will implement it at some point if necessary, but I think we should focus on getting it working first. You should not need to use your own logging package, and you can make the command have good logging output by doing xe.Verbose().Run(...). We will not rename xe to commandLine, since we prefer shorter package names that make it easier to type. We will try to have readable field and function names, but package names should be short, as specified in Effective Go. I will test the app now and see if I can get it to work.

kkoreilly commented 3 months ago

The issue is that you are doing the response fetching and async update calls in the same goroutine in the event handler, which does not work. You need to do it in a separate goroutine, which I just added. You should try it now and see if it works. Also, I improved the error handling: the key thing is to actually handle the error values you get. The best thing to do is to make error snackbars with them, as I did in my commit. You should follow what I did for future error handling. Please let me know if you have any other issues.

ddkwork commented 3 months ago

I'm sorry, we can't agree on this issue, you have too many restrictions, it's unbelievable. Joining the thread as you say will communicate with the server side normally, and you can change it yourself

kkoreilly commented 3 months ago

I am sorry for the misunderstanding. I absolutely want this to work as well as possible, and I am not trying to impose any unnecessary restrictions on you. I am just giving you information on how to implement a GUI-friendly server communication mechanism. With the new changes I added, it should now be fully working.

ddkwork commented 3 months ago

At the moment I can only accept my own troubleshooting system, because I can easily find errors and code locations through my own packaging, and I have almost 50 modules of my own through which I can quickly locate all kinds of bugs, and my own personal cleanliness has been developed in such a way that it has become consistent in those 50 modules: all code basically does not have "if err!=nil " this statement, err flying all over the world to affect the readability of the code, any departure of the method of error a little mouse to see the source code location, without busy searching around, I personally tired of all kinds of logging package formatting commands, so I have their own logging package needs to be used, basically no more than 20 sentences in all modules to use the formatting commands, these cumbersome work! The logging package does all the tedious work. In addition, my entire module code basically doesn't ignore any errors, even the various "close" operations, I can see in the logs whether it has been executed correctly or not. Finally, I basically don't have to use shorthand instead of anything, and all of my code pages don't have the very long naming that C++ has. Also, not all errors have to be shown in the gui, for example, frequent network requests require more judgment and it fits in the log. Similar logic to this is: I store all the errors that may occur in the code of all modules uniformly in the log package, and when the gui rendering is needed, I will call log.body() to populate the ui, these habits and ways we are not likely to be consistent, and my aim is to reduce any sample code, improve the readability of any code that can be optimized, and try to make unit tests cover any function and method that. Any interface has an empty object instantiated to check whether the signature is implemented, etc. It's possible that everyone's coding style is inconsistent, which makes it hard to continue our collaboration.

ddkwork commented 3 months ago

It's my way, and I'm not likely to change my habits, as many modules have face-valued its ease of use and security

"C:\Program Files\Go\bin\go.exe" build -o C:\Users\Admin\AppData\Local\JetBrains\GoLand2023.3\tmp\GoLand\___6go_build_branch_gpt4_ai.exe branch/gpt4/ai #gosetup
C:\Users\Admin\AppData\Local\JetBrains\GoLand2023.3\tmp\GoLand\___6go_build_branch_gpt4_ai.exe
[2024-03-11 15:06:05]   Trace ->  --------- title --------- | ------------------ info ------------------ //runtime.doInit1+0xec C:/Program Files/Go/src/runtime/proc.go:7176
[2024-03-11 15:06:52] Warning ->              connect serve | Send "ok" to the serve,please wait a while //main.main.func11.1+0xc9 D:/workspace/workspace/branch/gpt4/ai/ai.go:92
Sure, I'm here to assist you with any questions or tasks you may have. Is there anything I can help you with today?
[2024-03-11 15:07:06] Success ->                       done | finished //main.HandleToken+0x145 D:/workspace/workspace/branch/gpt4/ai/ollama.go:82
[2024-03-11 15:08:09] Warning ->              connect serve | Send "nice" to the serve,please wait a while //main.main.func11.1+0xc9 D:/workspace/workspace/branch/gpt4/ai/ai.go:92
Thank you for the kind compliment! I'm happy to hear that you find my responses to be nice.

Is there anything I can do to make your day a little brighter?
[2024-03-11 15:08:14] Success ->                       done | finished //main.HandleToken+0x145 D:/workspace/workspace/branch/gpt4/ai/ollama.go:82
[2024-03-11 15:08:27] Warning ->              connect serve | Send "nice work" to the serve,please wait a while //main.main.func11.1+0xc9 D:/workspace/workspace/branch/gpt4/ai/ai.go:92
Thank you! I'm glad you find my work satisfactory. Is there anything I can do for you today?
[2024-03-11 15:08:30] Success ->                       done | finished //main.HandleToken+0x145 D:/workspace/workspace/branch/gpt4/ai/ollama.go:82

go 1.22.1

use (
    .
    ./branch
    ./branch/VisualStudiokit/ms
    ./branch/VisualStudiokit/ms/pdbfetch
    ./branch/VisualStudiokit/vskit
    ./branch/VisualStudiokit/vskit/vs_export
    ./branch/crypt
    ./branch/datarecovery
    ./branch/datarecovery/keygen
    ./branch/datarecovery/keygen/internal/keygen1
    ./branch/demo
    ./branch/environment
    ./branch/explorer/vstart
    ./branch/golibrary
    ./branch/gomitmproxy
    ./branch/gomitmproxy/plugin/steamDecoder/go-steam-add_auth_session_ticket
    ./branch/gomitmproxy/plugin/steamDecoder/steamLogin-master
    ./branch/gomitmproxy/plugin/steamDecoder/udplogin/go-steam-master
    ./branch/gomitmproxy/websocket@v1.5.0
    ./branch/gpt4/nlp
    ./branch/gpt4/nlp/translate
    ./branch/gpt4/ollama/ollama/Struct2tree
    ./branch/gpt4/ollama/ollama/cstruct
    ./branch/gpt4/ollama/ollama/json2go
    ./branch/gpt4/ollama/ollama/json2go/jsonom-main
    ./branch/gpt4/ollama/ollama/tree
    ./branch/gpt4/ollama/ollamaGui
    ./branch/gui
    ./branch/hardwareIndo
    ./branch/jetbra
    ./branch/mypan
    ./branch/mypan/PanIndex-dev
    ./branch/network
    ./branch/pkg
    ./branch/pkg/cpp2go
    ./branch/pkg/cpp2go/cpp/cpp2go-master
    ./branch/pkg/cpp2go/ewdk/cgo/c-for-go
    ./branch/pkg/cpp2go/ewdk/cgo/c-for-go/c-for-go.wiki/github.com/joscha-alisch/go-cgen@v0.0.0-20211220113321-3af71b45a262
    ./branch/pkg/cpp2go/ewdk/cgo/go-winio
    ./branch/pkg/cpp2go/ewdk/cgo/goSocksTap
    ./branch/pkg/cpp2go/ewdk/cgo/ndigo5
    ./branch/pkg/cpp2go/ewdk/go-build
    ./branch/pkg/windef
    ./game
    ./go-1brc-master
    ./go-github
    ./go-github/example
    ./go-github/example/newreposecretwithlibsodium
    ./go-github/scrape
    ./go-github/tools
    ./mergeCore
)
ddkwork commented 3 months ago

A long time ago, formatting such algorithmic logs involved writing a lot of repetitive formatting commands, yet now it's just a matter of plugging in headers and variables. Each of these things have their own preferences, let's spend our time fixing CORE bugs and developing new widgets, shall we? That's where this issue stops.

"C:\Program Files\Go\bin\go.exe" test -c -o C:\Users\Admin\AppData\Local\JetBrains\GoLand2023.3\tmp\GoLand\___TestSuperRecovery4_in_github_com_ddkwork_keygen.test.exe github.com/ddkwork/keygen #gosetup
"C:\Program Files\Go\bin\go.exe" tool test2json -t C:\Users\Admin\AppData\Local\JetBrains\GoLand2023.3\tmp\GoLand\___TestSuperRecovery4_in_github_com_ddkwork_keygen.test.exe -test.v -test.paniconexit0 -test.run ^\QTestSuperRecovery4\E$ #gosetup
[2024-03-11 15:50:06]   Trace ->  --------- title --------- | ------------------ info ------------------ //runtime.doInit1+0xec C:/Program Files/Go/src/runtime/proc.go:7176
=== RUN   TestSuperRecovery4
[2024-03-11 15:50:06] Success ->                        mid | E74B-C317-C87F-F209-CDA9 //github.com/ddkwork/keygen.(*superRecovery4).GenRegCode+0x21 D:/workspace/workspace/branch/datarecovery/keygen/superRecovery4.go:82
[2024-03-11 15:50:06]     Hex ->                     fixed2 | 0x76ade38c5e054f5b165d //github.com/ddkwork/keygen.(*superRecovery4).XorAlign+0x9d D:/workspace/workspace/branch/datarecovery/keygen/superRecovery4.go:142
[2024-03-11 15:50:06]     Hex ->       data[i] ^= fixed2[i] | 0x91e6209b967abd52dbf4 //github.com/ddkwork/keygen.(*superRecovery4).XorAlign+0xdc D:/workspace/workspace/branch/datarecovery/keygen/superRecovery4.go:146
[2024-03-11 15:50:06]     Hex ->          data to BigEndian | 0xf4db52bd7a969b20e691 //github.com/ddkwork/keygen.(*superRecovery4).XorAlign+0x16d D:/workspace/workspace/branch/datarecovery/keygen/superRecovery4.go:148
[2024-03-11 15:50:06]     Hex ->                     fixed1 | 0xba70bc13cc1f2dca4a74 //github.com/ddkwork/keygen.(*superRecovery4).XorAlign+0x225 D:/workspace/workspace/branch/datarecovery/keygen/superRecovery4.go:150
[2024-03-11 15:50:06]     Hex ->    newData[i] ^= fixed1[i] | 0x4eabeeaeb689b6eaace5 //github.com/ddkwork/keygen.(*superRecovery4).XorAlign+0x262 D:/workspace/workspace/branch/datarecovery/keygen/superRecovery4.go:154
[2024-03-11 15:50:06]     Hex -> firstEnd xor 0x72B8,机器码还有一个字节是丢弃的 | 0x97f6 //github.com/ddkwork/keygen             .(*superRecovery4).SetHash+0x4a D:/workspace/workspace/branch/datarecovery/keygen/superRecovery4.go:329
[2024-03-11 15:50:06] Success ->                     Xor #1 | ACEAB689|B6AEEEAB ^ 31B8063E|6A2D4C87 = 9D52B0B7|DC83A22C //github.com/ddkwork/keygen.(*bit64).Xor+0x315 D:/workspace/workspace/branch/datarecovery/keygen/api.go:222
[2024-03-11 15:50:06]     Hex ->                  Sort Data | 0x83522c9db0b7a2dc //github.com/ddkwork/keygen.(*superRecovery4).SortData+0xec D:/workspace/workspace/branch/datarecovery/keygen/superRecovery4.go:136
[2024-03-11 15:50:06]     Hex ->             des Encrypt #1 | 0x77df6a17a6ae2fa7 //github.com/ddkwork/keygen.(*object).DesEncode+0xb6 D:/workspace/workspace/branch/datarecovery/keygen/api.go:153
[2024-03-11 15:50:06] Success ->                     Xor #2 | A72FAEA6|176ADF77 ^ 31B8063E|6A2D4C87 = 9697A898|7D4793F0 //github.com/ddkwork/keygen.(*bit64).Xor+0x315 D:/workspace/workspace/branch/datarecovery/keygen/api.go:222
[2024-03-11 15:50:06]    Info ->             des Decrypt #2 | key 5531234038712A4D  U1#@8q*M  result:0XE48BA34EE0554ACE //github.com/ddkwork/keygen.(*object).DesDecode+0x235 D:/workspace/workspace/branch/datarecovery/keygen/api.go:165
[2024-03-11 15:50:06] Success ->                     Xor #3 | CE4A55E0|4EA38BE4 ^ C3B426D6|3928B92A = 0DFE7336|778B32CE //github.com/ddkwork/keygen.(*bit64).Xor+0x315 D:/workspace/workspace/branch/datarecovery/keygen/api.go:222
[2024-03-11 15:50:06] Success ->                     Xor #4 | 0DFE7336|778B32CE ^ 375C2E95|18D62A80 = 3AA25DA3|6F5D184E //github.com/ddkwork/keygen.(*bit64).Xor+0x315 D:/workspace/workspace/branch/datarecovery/keygen/api.go:222
[2024-03-11 15:50:06]    Info ->             des Decrypt #3 | key 39765D4B21782625  9v]K!x&%  result:0X0837D45F501D903D //github.com/ddkwork/keygen.(*object).DesDecode+0x235 D:/workspace/workspace/branch/datarecovery/keygen/api.go:165
[2024-03-11 15:50:06]     Hex ->  ----------hash----------- | 0x0837d45f501d903d //github.com/ddkwork/keygen.(*superRecovery4).SetHash+0x2ce D:/workspace/workspace/branch/datarecovery/keygen/superRecovery4.go:341
[2024-03-11 15:50:06] Success ->                     Xor #5 | 3D901D50|5FD43708 ^ 8048AC32|A8233DA3 = BDD8B162|F7F70AAB //github.com/ddkwork/keygen.(*bit64).Xor+0x315 D:/workspace/workspace/branch/datarecovery/keygen/api.go:222
[2024-03-11 15:50:06]     Hex ->             des Encrypt #4 | 0xad18338b5036bdd2 //github.com/ddkwork/keygen.(*object).DesEncode+0xb6 D:/workspace/workspace/branch/datarecovery/keygen/api.go:153
[2024-03-11 15:50:06] Success ->                     Xor #6 | D2BD3650|8B3318AD ^ C382E80C|38A3297A = 113FDE5C|B39031D7 //github.com/ddkwork/keygen.(*bit64).Xor+0x315 D:/workspace/workspace/branch/datarecovery/keygen/api.go:222
[2024-03-11 15:50:06] Success ->                     Xor #7 | 3D901D50|5FD43708 ^ 03A76C94|C938E29F = 3E3771C4|96ECD597 //github.com/ddkwork/keygen.(*bit64).Xor+0x315 D:/workspace/workspace/branch/datarecovery/keygen/api.go:222
[2024-03-11 15:50:06]     Hex ->             des Encrypt #5 | 0xbb18622072d7434a //github.com/ddkwork/keygen.(*object).DesEncode+0xb6 D:/workspace/workspace/branch/datarecovery/keygen/api.go:153
[2024-03-11 15:50:06] Success ->                     Xor #8 | 4A43D772|206218BB ^ AD72646D|985C82E1 = E731B31F|B83E9A5A //github.com/ddkwork/keygen.(*bit64).Xor+0x315 D:/workspace/workspace/branch/datarecovery/keygen/api.go:222
[2024-03-11 15:50:06] Success ->                     Xor #9 | 3D901D50|5FD43708 ^ 3228FE29|77328A3C = 0FB8E379|28E6BD34 //github.com/ddkwork/keygen.(*bit64).Xor+0x315 D:/workspace/workspace/branch/datarecovery/keygen/api.go:222
[2024-03-11 15:50:06]     Hex ->             des Encrypt #6 | 0x69807c677e40f5b2 //github.com/ddkwork/keygen.(*object).DesEncode+0xb6 D:/workspace/workspace/branch/datarecovery/keygen/api.go:153
[2024-03-11 15:50:06] Success ->                    Xor #10 | B2F5407E|677C8069 ^ A283E281|32835249 = 1076A2FF|55FFD220 //github.com/ddkwork/keygen.(*bit64).Xor+0x315 D:/workspace/workspace/branch/datarecovery/keygen/api.go:222
[2024-03-11 15:50:06]     Hex ->                          x | 0x5fd43708 //github.com/ddkwork/keygen.(*superRecovery4).SortDataByHash+0x190 D:/workspace/workspace/branch/datarecovery/keygen/superRecovery4.go:204
[2024-03-11 15:50:06]     Hex ->            x ^= 0x3228fe29 | 0x6dfcc921 //github.com/ddkwork/keygen.(*superRecovery4).SortDataByHash+0x1bb D:/workspace/workspace/branch/datarecovery/keygen/superRecovery4.go:206
[2024-03-11 15:50:06]     Hex ->            x &= 0x000000ff | 0x21 //github.com/ddkwork/keygen.(*superRecovery4).SortDataByHash+0x1ea D:/workspace/workspace/branch/datarecovery/keygen/superRecovery4.go:208
[2024-03-11 15:50:06]    Info ->                    x %= 21 | 12 //github.com/ddkwork/keygen.(*superRecovery4).SortDataByHash+0x21c D:/workspace/workspace/branch/datarecovery/keygen/superRecovery4.go:210
[2024-03-11 15:50:06]    Info ->                        x++ | 13 //github.com/ddkwork/keygen.(*superRecovery4).SortDataByHash+0x270 D:/workspace/workspace/branch/datarecovery/keygen/superRecovery4.go:212
[2024-03-11 15:50:06]    Info ->                      index | 13 //github.com/ddkwork/keygen.(*superRecovery4).SortDataByHash+0x438 D:/workspace/workspace/branch/datarecovery/keygen/superRecovery4.go:226
[2024-03-11 15:50:06]     Hex ->                 indexValue | 0x3000102 //github.com/ddkwork/keygen.(*superRecovery4).SortDataByHash+0x48c D:/workspace/workspace/branch/datarecovery/keygen/superRecovery4.go:227
[2024-03-11 15:50:06]     Hex ->          Sort Data By hash | 0xffd2205576a2ff10 //github.com/ddkwork/keygen.(*superRecovery4).SortDataByHash+0x4bb D:/workspace/workspace/branch/datarecovery/keygen/superRecovery4.go:228
[2024-03-11 15:50:06]     Hex ->                       hash | 0x0837d45f501d903d //github.com/ddkwork/keygen.(*superRecovery4).SortDataByHash+0x4f6 D:/workspace/workspace/branch/datarecovery/keygen/superRecovery4.go:229
[2024-03-11 15:50:06]    Info ->             des Decrypt #7 | key 2625407B39217A28  &%@{9!z(  result:0XD65F8ED217535BCF //github.com/ddkwork/keygen.(*object).DesDecode+0x235 D:/workspace/workspace/branch/datarecovery/keygen/api.go:165
[2024-03-11 15:50:06] Success ->                    Xor #11 | CF5B5317|D28E5FD6 ^ 1BD9E17C|A92C9A27 = D482B26B|7BA2C5F1 //github.com/ddkwork/keygen.(*bit64).Xor+0x315 D:/workspace/workspace/branch/datarecovery/keygen/api.go:222
[2024-03-11 15:50:06]     Hex ->                     w1 Xor | 0xf687 //github.com/ddkwork/keygen.(*superRecovery4).MakeW1234+0x3f D:/workspace/workspace/branch/datarecovery/keygen/superRecovery4.go:293
[2024-03-11 15:50:06]     Hex ->                     w2 Xor | 0xb53b //github.com/ddkwork/keygen.(*superRecovery4).MakeW1234+0x71 D:/workspace/workspace/branch/datarecovery/keygen/superRecovery4.go:294
[2024-03-11 15:50:06]     Hex ->                     w3 Xor | 0x5ab6 //github.com/ddkwork/keygen.(*superRecovery4).MakeW1234+0xaa D:/workspace/workspace/branch/datarecovery/keygen/superRecovery4.go:295
[2024-03-11 15:50:06]     Hex ->                     w4 Xor | 0x5aff //github.com/ddkwork/keygen.(*superRecovery4).MakeW1234+0xdf D:/workspace/workspace/branch/datarecovery/keygen/superRecovery4.go:296
[2024-03-11 15:50:06]     Hex ->                  makeW1234 | 0x87f63bb5b65aff5a //github.com/ddkwork/keygen.(*superRecovery4).MakeW1234+0x194 D:/workspace/workspace/branch/datarecovery/keygen/superRecovery4.go:300
[2024-03-11 15:50:06]     Hex ->             des Encrypt #8 | 0x8715c3d0cedded85 //github.com/ddkwork/keygen.(*object).DesEncode+0xb6 D:/workspace/workspace/branch/datarecovery/keygen/api.go:153
[2024-03-11 15:50:06]     Hex ->                      code4 | 0x6fb8 //github.com/ddkwork/keygen.(*superRecovery4).SetCode4+0x7e D:/workspace/workspace/branch/datarecovery/keygen/superRecovery4.go:555
[2024-03-11 15:50:06]     Hex ->                      word5 | 0x6770 //github.com/ddkwork/keygen.(*superRecovery4).GenRegCode+0x117 D:/workspace/workspace/branch/datarecovery/keygen/superRecovery4.go:102
[2024-03-11 15:50:06]     Hex ->                  word5 xor | 0xe553 //github.com/ddkwork/keygen.(*superRecovery4).GenRegCode+0x15b D:/workspace/workspace/branch/datarecovery/keygen/superRecovery4.go:104
[2024-03-11 15:50:06]     Hex ->                replace end | 0x8715c3d0cedd53e5 //github.com/ddkwork/keygen.(*superRecovery4).SetCode1235+0x39 D:/workspace/workspace/branch/datarecovery/keygen/superRecovery4.go:305
[2024-03-11 15:50:06]     Hex ->             des Encrypt #9 | 0x1257534e9de91373 //github.com/ddkwork/keygen.(*object).DesEncode+0xb6 D:/workspace/workspace/branch/datarecovery/keygen/api.go:153
[2024-03-11 15:50:06]     Hex ->                        Xor | 0xdb7dfcfc5fd17d12 //github.com/ddkwork/keygen.(*superRecovery4).SetCode1235+0x13b D:/workspace/workspace/branch/datarecovery/keygen/superRecovery4.go:311
[2024-03-11 15:50:06]  Struct ->                            |  //github.com/ddkwork/keygen.(*superRecovery4).SetCode1235+0x1f3 D:/workspace/workspace/branch/datarecovery/keygen/superRecovery4.go:317
keygen.ctx{word1:0xf687, word2:0xb53b, word3:0x5ab6, word4:0x5aff, word5:0xe553, code1:0x127d, code2:0x7ddb, code3:0xd15f, code4:0x6fb8, code5:0xfcfc, code6:0x0}
[2024-03-11 15:50:06] Success ->                    RegCode | 127D-7DDB-D15F-6FB8-FCFC //github.com/ddkwork/keygen.(*object).RegCode+0x1d D:/workspace/workspace/branch/datarecovery/keygen/api.go:112

    keygen_test.go:90: 
            Error Trace:    D:/workspace/workspace/branch/datarecovery/keygen/keygen_test.go:90
            Error:          Not equal: 
                            expected: "6CCF-5BD8-EAEB-E4ED-159B"
                            actual  : "127D-7DDB-D15F-6FB8-FCFC"

                            Diff:
                            --- Expected
                            +++ Actual
                            @@ -1 +1 @@
                            -6CCF-5BD8-EAEB-E4ED-159B
                            +127D-7DDB-D15F-6FB8-FCFC
            Test:           TestSuperRecovery4
--- FAIL: TestSuperRecovery4 (0.01s)

Expected :6CCF-5BD8-EAEB-E4ED-159B
Actual   :127D-7DDB-D15F-6FB8-FCFC
<Click to see difference>

FAIL

Process finished with the exit code 1
kkoreilly commented 3 months ago

Fine, you can use your own logging package for now, as long as all of the errors are properly handled.

ddkwork commented 3 months ago

All the bugs have been dealt with, and the next thing to do is to expand the function and beautify the interface, as well as fix all the model tag stuffing and so on. It's late now, I'll refresh the code tomorrow

---Original--- From: @.> Date: Tue, Mar 12, 2024 02:18 AM To: @.>; Cc: @.>;"State @.>; Subject: Re: [cogentcore/core] markdown sync (Issue #929)

Fine, you can use your own logging package for now, as long as all of the errors are properly handled.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you modified the open/close state.Message ID: @.***>

kkoreilly commented 3 months ago

Okay. Please let me know if you have any issues.

ddkwork commented 3 months ago

At present, it has been interacted with the server normally, and other details can be updated after the md supports syntax highlighting. The problem is: I haven't been able to debug the ins and outs of a problem, where are the parameters of the style callback function of all the widgets instantiated, because it's nil that causes a lot of panic, not just the location I mentioned. I debugged for a day before and didn't see any widget calls styles. New() or something like that

---Original--- From: @.> Date: Tue, Mar 12, 2024 09:47 AM To: @.>; Cc: @.>;"State @.>; Subject: Re: [cogentcore/core] markdown sync (Issue #929)

Okay. Please let me know if you have any issues.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you modified the open/close state.Message ID: @.***>

kkoreilly commented 3 months ago

Please send me all of the stack traces of any panics that you get, and I will debug them. It is not an efficient use of your time to debug panics.

ddkwork commented 3 months ago

It's hard to catch, unless you save it at the time, and it gives me the impression that s is random nil, the illusion of a type read-write conflict, you want it to be nil, it doesn't come, you don't let nil, it panics at the critical moment, and the process of instantiation of it is always a mystery

---Original--- From: @.> Date: Tue, Mar 12, 2024 10:28 AM To: @.>; Cc: @.>;"State @.>; Subject: Re: [cogentcore/core] markdown sync (Issue #929)

Please send me all of the stack traces of any panics that you get, and I will debug them. It is not an efficient use of your time to debug panics.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you modified the open/close state.Message ID: @.***>

ddkwork commented 3 months ago

That's how I understand it, all widgets implement the ki interface and extension methods, and the style through the polymorphism of this ki interface is to put it bluntly: "method rewrite", which is a bit similar to the function overloading feature of cpp, but it is different. Debugged various methods and rewrote and still can't see any operations for style. Then the problem may be in the event handling, such as the previous bug of deleting slice members and not handling subscripts, but I still didn't find a similar mysterious operation after digging through the event handling code. In short, can you tell me a rough idea of where the parameters of the style callback function come from?

---Original--- From: @.> Date: Tue, Mar 12, 2024 10:28 AM To: @.>; Cc: @.>;"State @.>; Subject: Re: [cogentcore/core] markdown sync (Issue #929)

Please send me all of the stack traces of any panics that you get, and I will debug them. It is not an efficient use of your time to debug panics.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you modified the open/close state.Message ID: @.***>

kkoreilly commented 3 months ago

I do not understand; every time the program crashes, you should be able to easily copy the stack trace. However, if you want a simple overview of how the stylers are called, here it is:

ddkwork commented 3 months ago

Don't be confused, maybe I can't accurately describe what I mean in translated English: what I'm saying is that panic didn't save the stack at the time, so I can't copy it until the next time I encounter panic, and it's unrealistic to force such and such a program to panic and copy the stack now, because the stylenil pointer seems to be random, but I did encounter panic many times before because style is nil, However, considering you've been busy working on the problem list and developing the widget, I haven't been able to report it to you. But recently I haven't seen much updates all day, sometimes I haven't submitted code or fix issue list for a day or two, and I thought you were free, so I asked you this question.

---Original--- From: @.> Date: Tue, Mar 12, 2024 11:17 AM To: @.>; Cc: @.>;"State @.>; Subject: Re: [cogentcore/core] markdown sync (Issue #929)

I do not understand; every time the program crashes, you should be able to easily copy the stack trace. However, if you want a simple overview of how the stylers are called, here it is:

Stylers are set using the Style method, which adds to a Stylers slice on WidgetBase

In a later function call, ApplyStyleTree, the ApplyStyleWidget method is called for each widget, which goes through the stylers and applies them to the widget's styles before it is rendered

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you modified the open/close state.Message ID: @.***>

kkoreilly commented 3 months ago

You should always report panics to me, and I will get to them eventually, even if I am busy. I was working on another project that uses Cogent Core for the past few days.