BotLibre
В демоверсии вызывается библиотечный компонент, затем через пять функций демонстрируется работа компонента.
<?xml version="1.0" encoding="utf-8"?>
<DirectionalLayout
xmlns:ohos="http://schemas.huawei.com/res/ohos"
ohos:id="$+id:abilityChat"
ohos:height="match_parent"
ohos:width="match_parent"
ohos:orientation="vertical"
>
<DirectionalLayout
ohos:id="$+id:chatToolBar"
ohos:height="match_content"
ohos:width="match_parent"
ohos:background_element="#eee"
ohos:orientation="horizontal"
>
<Image
ohos:id="$+id:icon"
ohos:height="32vp"
ohos:width="32vp"
ohos:margin="4vp"
ohos:scale_mode="zoom_center"
/>
<Text
ohos:id="$+id:title"
ohos:height="match_content"
ohos:width="0vp"
ohos:margin="8vp"
ohos:text=""
ohos:text_size="20fp"
ohos:weight="1"
/>
</DirectionalLayout>
...
``` **В запросе скорее всего текст технической направленности из области разработки и тестирования программного обеспечения. Основной язык текста запроса — это язык программирования Java.**
**Перевод текста на русский язык:**
```java
public void submitChat() {
ChatConfig config = new ChatConfig();
//config.instance = this.instance.id;
config.conversation = MainAbility.conversation;
config.speak = !MainAbility.deviceVoice;
config.avatar = this.avatarId;
if (MainAbility.translate && MainAbility.voice != null) {
config.language = MainAbility.voice.language;
}
if (MainAbility.disableVideo) {
config.avatarFormat = "image";
} else {
config.avatarFormat = MainAbility.webm ? "webm" : "mp4";
}
config.avatarHD = MainAbility.hd;
config.message = editText.getText().toString().trim();
if (config.message.equals("")) {
return;
}
this.messages.add(config);
handler.sendEvent(LIST_CONTAINER);
HttpChatAction action = new HttpChatAction(ChatAbility.this, config);
action.execute();
editText.setText("");
resetToolbar();
webView.load(null, "thinking...", "text/html", "utf-8", null);
//Check the volume
AudioManager audioManager = new AudioManager(ability);
int volume = 0;
try {
volume = audioManager.getVolume(AudioManager.AudioVolumeType.STREAM_MUSIC);
} catch (AudioRemoteException e) {
e.printStackTrace();
}
if (volume <= 1 && volumeChecked) {
ToastUtils.show(this, "Please check 'Media' volume");
volumeChecked = false;
}
//stop letting the mic on.
stopListening();
//its Important for "sleep" "scream" ...etc commands.
//this will turn off the mic
MainAbility.listenInBackground = false;
}
В sdk6, DevEco Studio2.2 Beta1 проект можно запустить напрямую. Если не удаётся запустить, удалите файлы проекта .gradle, .idea, build, gradle, build.gradle и создайте новый проект в соответствии с вашей версией. Скопируйте соответствующие файлы нового проекта в корневой каталог.
You can comment after Login
Inappropriate content may be displayed here and will not be shown on the page. You can check and modify it through the relevant editing function
If you confirm that the content does not involve inappropriate language/advertisement redirection/violence/vulgar pornography/infringement/piracy/false/insignificant or illegal content related to national laws and regulations, you can click submit to make an appeal, and we will handle it as soon as possible.
Comments ( 0 )