From 69aa92caf222ba776ff469c011ce11220a5e38a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=99=E6=B3=93=E9=93=AE?= Date: Thu, 31 Jul 2025 11:13:32 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9Elogid=E9=80=8F?= =?UTF-8?q?=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 4 ++++ go.sum | 10 ++++++++++ internal/version/VERSION | 2 +- uixt/ai/wings_service.go | 26 ++++++++------------------ uixt/driver_ext_ai_test.go | 4 ++-- 5 files changed, 25 insertions(+), 21 deletions(-) diff --git a/go.mod b/go.mod index 3abfe4f7..392b2404 100644 --- a/go.mod +++ b/go.mod @@ -48,11 +48,15 @@ require ( ) require ( + code.byted.org/gopkg/ctxvalues v0.4.0 // indirect + code.byted.org/gopkg/logid v0.0.0-20241008043456-230d03adb830 // indirect + code.byted.org/gopkg/net2 v1.2.0 // indirect github.com/alecthomas/chroma/v2 v2.14.0 // indirect github.com/antchfx/xpath v1.3.3 // indirect github.com/atotto/clipboard v0.1.4 // indirect github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/aymerick/douceur v0.2.0 // indirect + github.com/bytedance/gopkg v0.0.0-20211103090529-d4719f74be3d // indirect github.com/bytedance/sonic/loader v0.2.4 // indirect github.com/catppuccin/go v0.2.0 // indirect github.com/cenkalti/backoff v2.2.1+incompatible // indirect diff --git a/go.sum b/go.sum index a4404074..818a0440 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,10 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +code.byted.org/gopkg/ctxvalues v0.4.0 h1:31pwEthLdrjbn/vmq0AgehFHvH1QlMSBca+KFvfL2uY= +code.byted.org/gopkg/ctxvalues v0.4.0/go.mod h1:xaQkBQksiY6rtaDilHDy1yYvvOARMdOIPf1BvimjfGE= +code.byted.org/gopkg/logid v0.0.0-20241008043456-230d03adb830 h1:+Msg9hILmtkMi+MrWblG50517OAJiOJGCJNDroRjkDU= +code.byted.org/gopkg/logid v0.0.0-20241008043456-230d03adb830/go.mod h1:UWtjHynVwwLkHxYiarvtfXCkxiOMpEFKAu5n8pop9R4= +code.byted.org/gopkg/net2 v1.2.0 h1:Bxc8ixC/rOWNha1XXbkzHs+y60hWPNPtCuojCZbkg5o= +code.byted.org/gopkg/net2 v1.2.0/go.mod h1:R+TvSEn+fkrfLgVwQ7KtlssZ5bZ2Vcew9pyhL7LrlkU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ4pzQ= github.com/MakeNowJust/heredoc v1.0.0/go.mod h1:mG5amYoWBHf8vpLOuehzbGGw0EHxpZZ6lCpQ4fNJ8LE= @@ -30,6 +36,8 @@ github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngE github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= github.com/bugsnag/bugsnag-go v1.4.0/go.mod h1:2oa8nejYd4cQ/b0hMIopN0lCRxU0bueqREvZLWFrtK8= github.com/bugsnag/panicwrap v1.2.0/go.mod h1:D/8v3kj0zr8ZAKg1AQ6crr+5VwKN5eIywRkfhyM/+dE= +github.com/bytedance/gopkg v0.0.0-20211103090529-d4719f74be3d h1:vibs+JRVU76xBvTK/EVfv8AwFr8+bZfUOgLwE6Kyq3A= +github.com/bytedance/gopkg v0.0.0-20211103090529-d4719f74be3d/go.mod h1:birsdqRCbwnckJbdAvcSao+AzOyibVEoWB55MjpYpB8= github.com/bytedance/mockey v1.2.14 h1:KZaFgPdiUwW+jOWFieo3Lr7INM1P+6adO3hxZhDswY8= github.com/bytedance/mockey v1.2.14/go.mod h1:1BPHF9sol5R1ud/+0VEHGQq/+i2lN+GTsr3O2Q9IENY= github.com/bytedance/sonic v1.13.3 h1:MS8gmaH16Gtirygw7jV91pDCN33NyMrPbN7qiYhEsF0= @@ -488,6 +496,7 @@ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= @@ -507,6 +516,7 @@ golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210415045647-66c3f260301c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/internal/version/VERSION b/internal/version/VERSION index dc1711bb..043ab204 100644 --- a/internal/version/VERSION +++ b/internal/version/VERSION @@ -1 +1 @@ -v5.0.0-250730 +v5.0.0-250731 diff --git a/uixt/ai/wings_service.go b/uixt/ai/wings_service.go index 0755952a..fc28ba20 100644 --- a/uixt/ai/wings_service.go +++ b/uixt/ai/wings_service.go @@ -8,10 +8,10 @@ import ( "io" "net/http" "os" - "strconv" "strings" "time" + "code.byted.org/gopkg/logid" "github.com/cloudwego/eino/schema" "github.com/google/uuid" "github.com/pkg/errors" @@ -144,14 +144,17 @@ func (w *WingsService) Plan(ctx context.Context, opts *PlanningOptions) (*Planni log.Info(). Str("thought", response.ThoughtChain.Thought). + Str("action", response.AgentType). + Str("action_params", response.ActionParams). + Str("log_id", fmt.Sprintf("%v", response.BaseResp.Extra)). Int("tool_calls_count", len(toolCalls)). Int64("elapsed_ms", elapsed). Msg("Wings API planning completed") return &PlanningResult{ ToolCalls: toolCalls, - Thought: response.ThoughtChain.Thought, - Content: response.ThoughtChain.Summary, + Thought: response.StepTextTrans, + Content: response.StepTextTrans, ModelName: "wings-api", }, nil } @@ -378,20 +381,7 @@ func (w *WingsService) resetHistory() { // generateWingsUUID generates a random UUID for LogID func generateWingsUUID() string { - return uuid.New().String() -} - -// parseOriStepIndex converts string to int64 with fallback to 0 -func parseOriStepIndex(index string) int64 { - if index == "" { - return 0 - } - - val, err := strconv.ParseInt(index, 10, 64) - if err != nil { - return 0 - } - return val + return logid.GenLogID() } // extractScreenshotFromMessage extracts base64 screenshot from message @@ -481,7 +471,7 @@ func (w *WingsService) callWingsAPI(ctx context.Context, request WingsActionRequ httpReq.Header.Add("Content-Type", "application/json") } - log.Info().Str("step_text", request.StepText).Str("biz_id", request.BizId).Str("url", w.apiURL).Msg("call wings api") + log.Info().Str("step_text", request.StepText).Str("log_id", request.Base.LogID).Str("biz_id", request.BizId).Str("url", w.apiURL).Msg("call wings api") // Execute HTTP request client := &http.Client{ diff --git a/uixt/driver_ext_ai_test.go b/uixt/driver_ext_ai_test.go index decfbf7a..89fd65c8 100644 --- a/uixt/driver_ext_ai_test.go +++ b/uixt/driver_ext_ai_test.go @@ -292,10 +292,10 @@ func TestDriverExt_AIAction(t *testing.T) { func TestDriverExt_AIAction_CompareWithAIAction(t *testing.T) { driver := setupDriverExt(t) - prompt := "点击返回按钮" + prompt := "[目标导向]向上滑动屏幕2次" // Test both methods with the same prompt - aiResult, aiErr := driver.AIAction(context.Background(), prompt) + aiResult, aiErr := driver.StartToGoal(context.Background(), prompt) // Both should execute without critical errors (may have different implementations) t.Logf("AIAction error: %v", aiErr)