change: addDeviceContextForWings

This commit is contained in:
lilong.129
2025-07-21 14:52:53 +08:00
parent 8b83f3ac78
commit 318c942860
2 changed files with 13 additions and 9 deletions

View File

@@ -1 +1 @@
v5.0.0-250720
v5.0.0-250721

View File

@@ -288,14 +288,6 @@ func (dExt *XTDriver) AIAssert(assertion string, opts ...option.ActionOption) (*
return assertResult, nil
}
// Context key types to avoid collisions
type contextKey string
const (
deviceIDKey contextKey = "device_id"
platformTypeKey contextKey = "platform_type"
)
// PlanNextAction performs planning and returns unified planning information
func (dExt *XTDriver) PlanNextAction(ctx context.Context, prompt string, opts ...option.ActionOption) (*PlanningExecutionResult, error) {
if dExt.LLMService == nil {
@@ -514,6 +506,14 @@ func (dExt *XTDriver) AIQuery(text string, opts ...option.ActionOption) (*AIExec
return aiResult, nil
}
// Context key types to avoid collisions
type contextKey string
const (
deviceIDKey contextKey = "device_id"
platformTypeKey contextKey = "platform_type"
)
// addDeviceContextForWings adds device information to context for Wings service
func (dExt *XTDriver) addDeviceContextForWings(ctx context.Context) context.Context {
device := dExt.GetDevice()
@@ -533,6 +533,10 @@ func (dExt *XTDriver) addDeviceContextForWings(ctx context.Context) context.Cont
platformType = "ios"
case *HarmonyDevice:
platformType = "harmony"
case *BrowserDevice:
platformType = "browser"
default:
platformType = "unknown"
}
ctx = context.WithValue(ctx, platformTypeKey, platformType)