mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-09 01:17:30 +08:00
change: addDeviceContextForWings
This commit is contained in:
@@ -1 +1 @@
|
|||||||
v5.0.0-250720
|
v5.0.0-250721
|
||||||
|
|||||||
+12
-8
@@ -288,14 +288,6 @@ func (dExt *XTDriver) AIAssert(assertion string, opts ...option.ActionOption) (*
|
|||||||
return assertResult, nil
|
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
|
// PlanNextAction performs planning and returns unified planning information
|
||||||
func (dExt *XTDriver) PlanNextAction(ctx context.Context, prompt string, opts ...option.ActionOption) (*PlanningExecutionResult, error) {
|
func (dExt *XTDriver) PlanNextAction(ctx context.Context, prompt string, opts ...option.ActionOption) (*PlanningExecutionResult, error) {
|
||||||
if dExt.LLMService == nil {
|
if dExt.LLMService == nil {
|
||||||
@@ -514,6 +506,14 @@ func (dExt *XTDriver) AIQuery(text string, opts ...option.ActionOption) (*AIExec
|
|||||||
return aiResult, nil
|
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
|
// addDeviceContextForWings adds device information to context for Wings service
|
||||||
func (dExt *XTDriver) addDeviceContextForWings(ctx context.Context) context.Context {
|
func (dExt *XTDriver) addDeviceContextForWings(ctx context.Context) context.Context {
|
||||||
device := dExt.GetDevice()
|
device := dExt.GetDevice()
|
||||||
@@ -533,6 +533,10 @@ func (dExt *XTDriver) addDeviceContextForWings(ctx context.Context) context.Cont
|
|||||||
platformType = "ios"
|
platformType = "ios"
|
||||||
case *HarmonyDevice:
|
case *HarmonyDevice:
|
||||||
platformType = "harmony"
|
platformType = "harmony"
|
||||||
|
case *BrowserDevice:
|
||||||
|
platformType = "browser"
|
||||||
|
default:
|
||||||
|
platformType = "unknown"
|
||||||
}
|
}
|
||||||
ctx = context.WithValue(ctx, platformTypeKey, platformType)
|
ctx = context.WithValue(ctx, platformTypeKey, platformType)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user