Tous les produits
Search
Centre de documentation

Intelligent Media Services:Intégrer un agent via un extrait de code

Dernière mise à jour :Aug 11, 2026

Cette rubrique explique comment tester rapidement votre agent IA à l'aide d'un jeton d'essai généré dans la console Intelligent Media Services (IMS), sans déployer de serveur.

Remarque

Cette solution est destinée uniquement aux tests et n'est pas recommandée pour une mise en production, car elle risque d'entraîner une utilisation abusive du shareToken.

Générer un jeton d'essai

  1. Accédez à la page AI Agents et recherchez l'agent à tester. Si aucun agent n'est disponible, créez-en un au préalable. Pour plus d'informations sur la création d'un agent, consultez Créer et gérer des agents IA.

  2. Cliquez sur QR Code for Demo dans la colonne Actions et sélectionnez la durée de validité du code QR.

  3. Cliquez sur Generate et enregistrez les codes QR générés.

    image

Intégrer l'agent IA

Web

Ajoutez le code d'installation dans la section <body> de la page web.

<script src="https://g.alicdn.com/apsara-media-aui/amaui-web-aicall/2.5.0/aicall-ui.js"></script>
<script>
  new ARTCAICallUI({
    userId: '123',                          // The user ID that joins communication. The user ID for business system login is recommended.
    root: document.getElementById('root'),  // The node where the UI is rendered. The interface fills the entire area.
    shareToken: 'xxxx',                     // The token copied from the console.
  }).render();
</script>

Android

Télécharger et intégrer le code source

  1. Téléchargez le code source depuis le dépôt GitHub.

  2. Importez AUIAICall : après le téléchargement du code source, dans Android Studio, allez dans File > New > Import Module et sélectionnez le dossier à importer.

  3. Modifiez les dépendances de bibliothèques tierces dans le fichier build.gradle.

    dependencies {
        implementation 'androidx.appcompat:appcompat:x.x.x'                     // Change x.x.x to the version compatible with your project
        implementation 'com.google.android.material:material:x.x.x'             // Change x.x.x to the version compatible with your project
        androidTestImplementation 'androidx.test.espresso:espresso-core:x.x.x'  // Change x.x.x to the version compatible with your project
        implementation 'com.aliyun.aio:AliVCSDK_ARTC:x.x.x'                  // Change x.x.x to the version compatible with your project
        implementation 'com.aliyun.auikits.android:ARTCAICallKit:x.x.x'
        implementation 'com.alivc.live.component:PluginAEC:2.0.0'
    }
    Remarque
    • Dernière version du SDK ARTC :

    • Dernière version du SDK AICallKit : .

  4. Attendez la fin de la synchronisation.

Exécuter et tester

Context currentActivity = AUIAICallEntranceActivity.this;
// The user ID that joins communication. The user ID for business system login is recommended.
String loginUserId = "123";
// The token copied from the console.
String shareToken = "xxxxx";
ARTCAICallController.launchCallActivity(currentActivity, shareToken, loginUserId, "");

iOS

Télécharger et intégrer le code source

  1. Téléchargez le code source depuis le dépôt GitHub.

  2. Importez AUIAICall : après avoir téléchargé le code depuis le dépôt, copiez le dossier iOS dans le répertoire de code de votre application. Renommez ce dossier en AUIAICall et placez-le au même niveau que votre Podfile. Vous pouvez supprimer les dossiers Example et AICallKit.

  3. Modifiez le Podfile pour importer les composants suivants :

    • AliVCSDK_ARTC : le kit de développement logiciel (SDK) client audio et vidéo pour l'interaction en temps réel. Vous pouvez également utiliser AliVCSDK_Standard ou AliVCSDK_InteractiveLive. Pour plus d'informations sur l'intégration, consultez Intégrer le SDK pour iOS.

    • ARTCAICallKit : le SDK dédié au scénario d'appel IA conversationnel en temps réel.

    • AUIFoundation : les composants d'interface utilisateur de base.

    • AUIAICall : le code source des composants d'interface utilisateur pour le scénario d'appel IA.

    # iOS 11.0 or later is required.
    platform :ios, '11.0'
    
    target 'Your app target' do
        # Integrate a suitable audio and video client SDK based on your business scenario. AliVCSDK_ARTC, AliVCSDK_Standard, and AliVCSDK_InteractiveLive are supported.
        pod 'AliVCSDK_ARTC', '~> 7.5.0'
    
        # The SDK for the Real-time Conversational AI call scenario.
        pod 'ARTCAICallKit', '~> 2.8.0'
    
        # The source code of the basic UI components.
        pod 'AUIFoundation', :path => "./AUIAICall/AUIBaseKits/AUIFoundation/", :modular_headers => true
    
        # The source code of the UI components for the AI call scenario.
        pod 'AUIAICall',  :path => "./AUIAICall/"
    end
    Remarque
    • Dernière version du SDK ARTC :

    • Dernière version du SDK AICallKit : .

  4. Exécutez la commande pod install --repo-update.

  5. L'intégration du code source est terminée.

Exécuter et tester

import AUIFoundation
import AUIAICall

// The following code can initiate a conversation with the agent. You can add the code snippet to your button click event.
AUIAICallManager.defaultManager.checkDeviceAuth(agentType: .VisionAgent) {
    let topVC = viewController ?? UIViewController.av_top()
    let controller = AUIAICallStandardController(userId: "123")   // The user ID that joins communication. The user ID for business system login is recommended.
    controller.agentShareInfo = "xxxxx"   // The token copied from the console.
    let vc = AUIAICallViewController(controller)
    vc.enableVoiceprintSwitch = false
    topVC.av_presentFullScreenViewController(vc, animated: true)
}