list) { mPlayer.playList(list); }
28 |
29 | public boolean play() {
30 | mPlayer.play();
31 | return true;
32 | }
33 |
34 | public boolean pause() {
35 | mPlayer.pause();
36 | return true;
37 | }
38 |
39 | public boolean prev() {
40 | mPlayer.prev();
41 | return true;
42 | }
43 |
44 | public boolean next() {
45 | mPlayer.next();
46 | return true;
47 | }
48 |
49 | public boolean stop() {
50 | mPlayer.stop();
51 | return true;
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/java/com/iflytek/aiui/demo/chat/ui/chat/ScrollSpeedLinearLayoutManger.java:
--------------------------------------------------------------------------------
1 | package com.iflytek.aiui.demo.chat.ui.chat;
2 |
3 | import android.content.Context;
4 | import android.graphics.PointF;
5 | import android.support.v7.widget.LinearLayoutManager;
6 | import android.support.v7.widget.LinearSmoothScroller;
7 | import android.support.v7.widget.RecyclerView;
8 | import android.util.DisplayMetrics;
9 |
10 | public class ScrollSpeedLinearLayoutManger extends LinearLayoutManager {
11 | private float MILLISECONDS_PER_INCH = 0.03f;
12 | private Context contxt;
13 |
14 | public ScrollSpeedLinearLayoutManger(Context context) {
15 | super(context);
16 | this.contxt = context;
17 | }
18 |
19 | @Override
20 | public void smoothScrollToPosition(RecyclerView recyclerView, RecyclerView.State state, int position) {
21 | LinearSmoothScroller linearSmoothScroller =
22 | new LinearSmoothScroller(recyclerView.getContext()) {
23 | @Override
24 | public PointF computeScrollVectorForPosition(int targetPosition) {
25 | return ScrollSpeedLinearLayoutManger.this
26 | .computeScrollVectorForPosition(targetPosition);
27 | }
28 |
29 | //This returns the milliseconds it takes to
30 | //scroll one pixel.
31 | @Override
32 | protected float calculateSpeedPerPixel
33 | (DisplayMetrics displayMetrics) {
34 | return MILLISECONDS_PER_INCH / displayMetrics.density;
35 | //返回滑动一个pixel需要多少毫秒
36 | }
37 |
38 | };
39 | linearSmoothScroller.setTargetPosition(position);
40 | startSmoothScroll(linearSmoothScroller);
41 | }
42 |
43 |
44 | public void setSpeedSlow() {
45 | //自己在这里用density去乘,希望不同分辨率设备上滑动速度相同
46 | //0.3f是自己估摸的一个值,可以根据不同需求自己修改
47 | MILLISECONDS_PER_INCH = contxt.getResources().getDisplayMetrics().density * 0.3f;
48 | }
49 |
50 | public void setSpeedFast() {
51 | MILLISECONDS_PER_INCH = contxt.getResources().getDisplayMetrics().density * 0.03f;
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/java/com/iflytek/aiui/demo/chat/ui/common/SingleLiveEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2017 Google Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.iflytek.aiui.demo.chat.ui.common;
18 |
19 | import android.arch.lifecycle.LifecycleOwner;
20 | import android.arch.lifecycle.MutableLiveData;
21 | import android.arch.lifecycle.Observer;
22 | import android.support.annotation.MainThread;
23 | import android.support.annotation.Nullable;
24 | import android.util.Log;
25 |
26 | import java.util.concurrent.atomic.AtomicBoolean;
27 |
28 | /**
29 | * A lifecycle-aware observable that sends only new updates after subscription, used for events like
30 | * navigation and Snackbar messages.
31 | *
32 | * This avoids a common problem with events: on configuration change (like rotation) an update
33 | * can be emitted if the observer is active. This LiveData only calls the observable if there's an
34 | * explicit call to setValue() or call().
35 | *
36 | * Note that only one observer is going to be notified of changes.
37 | */
38 | public class SingleLiveEvent extends MutableLiveData {
39 |
40 | private static final String TAG = "SingleLiveEvent";
41 |
42 | private final AtomicBoolean mPending = new AtomicBoolean(false);
43 |
44 | @MainThread
45 | public void observe(LifecycleOwner owner, final Observer observer) {
46 |
47 | if (hasActiveObservers()) {
48 | Log.w(TAG, "Multiple observers registered but only one will be notified of changes.");
49 | }
50 |
51 | // Observe the internal MutableLiveData
52 | super.observe(owner, new Observer() {
53 | @Override
54 | public void onChanged(@Nullable T t) {
55 | if (mPending.compareAndSet(true, false)) {
56 | observer.onChanged(t);
57 | }
58 | }
59 | });
60 | }
61 |
62 | @MainThread
63 | public void setValue(@Nullable T t) {
64 | mPending.set(true);
65 | super.setValue(t);
66 | }
67 |
68 | /**
69 | * Used for cases where T is Void, to make calls cleaner.
70 | */
71 | @MainThread
72 | public void call() {
73 | setValue(null);
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/java/com/iflytek/aiui/demo/chat/ui/common/widget/PopupWindowFactory.java:
--------------------------------------------------------------------------------
1 | package com.iflytek.aiui.demo.chat.ui.common.widget;
2 |
3 | import android.content.Context;
4 | import android.view.KeyEvent;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.PopupWindow;
8 |
9 |
10 | /**
11 | * 作者:Rance on 2016/11/29 10:47
12 | * 邮箱:rance935@163.com
13 | */
14 | public class PopupWindowFactory {
15 |
16 | private Context mContext;
17 |
18 | private PopupWindow mPop;
19 |
20 | /**
21 | * @param mContext 上下文
22 | * @param view PopupWindow显示的布局文件
23 | */
24 | public PopupWindowFactory(Context mContext, View view){
25 | this(mContext,view, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
26 | }
27 |
28 | /**
29 | * @param mContext 上下文
30 | * @param view PopupWindow显示的布局文件
31 | * @param width PopupWindow的宽
32 | * @param heigth PopupWindow的高
33 | */
34 | public PopupWindowFactory(Context mContext, View view, int width, int heigth){
35 | init(mContext,view,width,heigth);
36 | }
37 |
38 |
39 | private void init(Context mContext, View view, int width, int heigth){
40 | this.mContext = mContext;
41 |
42 | //下面这两个必须有!!
43 | view.setFocusable(true);
44 | view.setFocusableInTouchMode(true);
45 |
46 | // PopupWindow(布局,宽度,高度)
47 | mPop = new PopupWindow(view,width,heigth,true);
48 | mPop.setOutsideTouchable(false);
49 | mPop.setFocusable(true);
50 |
51 | // 重写onKeyListener,按返回键消失
52 | view.setOnKeyListener(new View.OnKeyListener() {
53 | @Override
54 | public boolean onKey(View v, int keyCode, KeyEvent event) {
55 | if (keyCode == KeyEvent.KEYCODE_BACK) {
56 | mPop.dismiss();
57 | return true;
58 | }
59 | return false;
60 | }
61 | });
62 |
63 | //点击其他地方消失
64 | // view.setOnTouchListener(new View.OnTouchListener() {
65 | // @Override
66 | // public boolean onTouch(View v, MotionEvent event) {
67 | // if (mPop != null && mPop.isShowing()) {
68 | // mPop.dismiss();
69 | // return true;
70 | // }
71 | // return false;
72 | // }});
73 |
74 |
75 | }
76 |
77 | public PopupWindow getPopupWindow(){
78 | return mPop;
79 | }
80 |
81 |
82 | /**
83 | * 以触发弹出窗的view为基准,出现在view的内部上面,弹出的pop_view左上角正对view的左上角
84 | * @param parent view
85 | * @param gravity 在view的什么位置 Gravity.CENTER、Gravity.TOP......
86 | * @param x 与控件的x坐标距离
87 | * @param y 与控件的y坐标距离
88 | */
89 | public void showAtLocation(View parent, int gravity, int x, int y){
90 |
91 | if(mPop.isShowing()){
92 | return ;
93 | }
94 | mPop.showAtLocation(parent, gravity, x, y);
95 |
96 | }
97 |
98 | /**
99 | * 以触发弹出窗的view为基准,出现在view的正下方,弹出的pop_view左上角正对view的左下角
100 | * @param anchor view
101 | */
102 | public void showAsDropDown(View anchor){
103 | showAsDropDown(anchor,0,0);
104 | }
105 |
106 | /**
107 | * 以触发弹出窗的view为基准,出现在view的正下方,弹出的pop_view左上角正对view的左下角
108 | * @param anchor view
109 | * @param xoff 与view的x坐标距离
110 | * @param yoff 与view的y坐标距离
111 | */
112 | public void showAsDropDown(View anchor, int xoff, int yoff){
113 | if(mPop.isShowing()){
114 | return ;
115 | }
116 |
117 | mPop.showAsDropDown(anchor, xoff, yoff);
118 | }
119 |
120 | /**
121 | * 隐藏PopupWindow
122 | */
123 | public void dismiss(){
124 | if (mPop.isShowing()) {
125 | mPop.dismiss();
126 | }
127 | }
128 |
129 | }
130 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/java/com/iflytek/aiui/demo/chat/ui/detail/DetailFragment.java:
--------------------------------------------------------------------------------
1 | package com.iflytek.aiui.demo.chat.ui.detail;
2 |
3 | import android.os.Bundle;
4 | import android.support.v4.app.Fragment;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 |
9 | import com.iflytek.aiui.demo.chat.R;
10 | import com.pddstudio.highlightjs.HighlightJsView;
11 | import com.pddstudio.highlightjs.models.Language;
12 | import com.pddstudio.highlightjs.models.Theme;
13 |
14 | import org.json.JSONException;
15 | import org.json.JSONObject;
16 |
17 | /**
18 | * 关于Fragment
19 | */
20 | public class DetailFragment extends Fragment {
21 | private static final String DETAIL_KEY = "detail";
22 |
23 | public static DetailFragment createDetailFragment(String content) {
24 | DetailFragment fragment = new DetailFragment();
25 | Bundle arguments = new Bundle();
26 | arguments.putString(DETAIL_KEY, content);
27 | fragment.setArguments(arguments);
28 |
29 | return fragment;
30 | }
31 |
32 | protected HighlightJsView mDetailView;
33 | @Override
34 | public View onCreateView(LayoutInflater inflater, ViewGroup container,
35 | Bundle savedInstanceState) {
36 | View mMainView = inflater.inflate(R.layout.detail_fragment, container, false);
37 | String content = getArguments().getString(DETAIL_KEY);
38 | mDetailView = (HighlightJsView) mMainView.findViewById(R.id.detail_js_view);
39 | mDetailView.setHighlightLanguage(Language.JSON);
40 | mDetailView.setTheme(Theme.ARDUINO_LIGHT);
41 | try {
42 | mDetailView.setSource(new JSONObject(content).toString(2));
43 | } catch (JSONException e) {
44 | mDetailView.setSource(content);
45 | }
46 | return mMainView;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/java/com/iflytek/aiui/demo/chat/ui/settings/SettingViewModel.java:
--------------------------------------------------------------------------------
1 | package com.iflytek.aiui.demo.chat.ui.settings;
2 |
3 | import android.arch.lifecycle.LiveData;
4 | import android.arch.lifecycle.ViewModel;
5 |
6 | import com.iflytek.aiui.demo.chat.repository.SettingsRepo;
7 |
8 | import javax.inject.Inject;
9 |
10 | /**
11 | * Created by PR on 2017/12/14.
12 | */
13 |
14 | public class SettingViewModel extends ViewModel {
15 | private SettingsRepo mSettingsRepo;
16 | @Inject
17 | public SettingViewModel(SettingsRepo settingsRepo) {
18 | mSettingsRepo = settingsRepo;
19 | }
20 |
21 | public void syncLastSetting() {
22 | mSettingsRepo.updateSettings();
23 | }
24 |
25 | public LiveData isWakeUpAvailable() {
26 | return mSettingsRepo.getWakeUpEnableState();
27 | }
28 | }
29 |
30 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/java/com/iflytek/aiui/demo/chat/ui/settings/SettingsFragment.java:
--------------------------------------------------------------------------------
1 | package com.iflytek.aiui.demo.chat.ui.settings;
2 |
3 | import android.arch.lifecycle.Observer;
4 | import android.arch.lifecycle.ViewModelProvider;
5 | import android.arch.lifecycle.ViewModelProviders;
6 | import android.content.Context;
7 | import android.content.SharedPreferences;
8 | import android.os.Bundle;
9 | import android.support.annotation.Nullable;
10 | import android.support.design.widget.Snackbar;
11 | import android.support.v7.preference.EditTextPreference;
12 | import android.support.v7.preference.PreferenceFragmentCompat;
13 | import android.support.v7.preference.SwitchPreferenceCompat;
14 |
15 | import com.iflytek.aiui.demo.chat.R;
16 |
17 | import javax.inject.Inject;
18 |
19 | import dagger.android.support.AndroidSupportInjection;
20 |
21 | /**
22 | * Created by PR on 2017/12/12.
23 | */
24 |
25 | public class SettingsFragment extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener {
26 | public static final String AIUI_EOS = "aiui_eos";
27 | public static final String AIUI_WAKEUP = "aiui_wakeup";
28 | @Inject
29 | ViewModelProvider.Factory mViewModelFactory;
30 | private SettingViewModel mSettingModel;
31 | private EditTextPreference eosPreference;
32 | private SwitchPreferenceCompat wakeupPreference;
33 |
34 | @Override
35 | public void onAttach(Context context) {
36 | super.onAttach(context);
37 | AndroidSupportInjection.inject(this);
38 | }
39 |
40 | @Override
41 | public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
42 | addPreferencesFromResource(R.xml.pref_settings);
43 | eosPreference = (EditTextPreference) (getPreferenceManager().findPreference(AIUI_EOS));
44 | eosPreference.setSummary(String.format("%sms", getPreferenceManager().getSharedPreferences().getString(AIUI_EOS, "1000")));
45 | wakeupPreference = (SwitchPreferenceCompat) getPreferenceManager().findPreference(AIUI_WAKEUP);
46 | }
47 |
48 | @Override
49 | public void onActivityCreated(Bundle savedInstanceState) {
50 | super.onActivityCreated(savedInstanceState);
51 | mSettingModel = ViewModelProviders.of(this, mViewModelFactory).get(SettingViewModel.class);
52 |
53 | mSettingModel.isWakeUpAvailable().observe(this, new Observer() {
54 | @Override
55 | public void onChanged(@Nullable Boolean enable) {
56 | wakeupPreference.setEnabled(enable);
57 | }
58 | });
59 | }
60 |
61 | @Override
62 | public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String s) {
63 | if(AIUI_EOS.equals(s)){
64 | String eos = sharedPreferences.getString(s, "1000");
65 | if(!isNumeric(eos)) {
66 | eosPreference.setText("1000");
67 | Snackbar.make(getView(), R.string.eos_invalid_tip , Snackbar.LENGTH_LONG).show();
68 | } else {
69 | eosPreference.setSummary(String.format("%sms", eos));
70 | }
71 | }
72 | }
73 |
74 |
75 | private boolean isNumeric(String str) {
76 | try {
77 | Integer.valueOf(str);
78 | return true;
79 | } catch (Exception e) {
80 | return false;
81 | }
82 | }
83 |
84 |
85 |
86 | @Override
87 | public void onResume() {
88 | super.onResume();
89 | getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
90 | }
91 |
92 | @Override
93 | public void onPause() {
94 | super.onPause();
95 | getPreferenceManager().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this);
96 | }
97 |
98 | @Override
99 | public void onStop() {
100 | super.onStop();
101 |
102 | mSettingModel.syncLastSetting();
103 | }
104 |
105 |
106 | }
107 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/java/com/iflytek/aiui/demo/chat/ui/view/ChatBubbleLayout.java:
--------------------------------------------------------------------------------
1 | package com.iflytek.aiui.demo.chat.ui.view;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 |
6 | import com.daasuu.bl.ArrowDirection;
7 | import com.daasuu.bl.BubbleLayout;
8 |
9 | /**
10 | * Created by pangxiezhou on 2018/1/6.
11 | */
12 |
13 | public class ChatBubbleLayout extends BubbleLayout {
14 | public ChatBubbleLayout(Context context) {
15 | super(context);
16 | }
17 |
18 | public ChatBubbleLayout(Context context, AttributeSet attrs) {
19 | super(context, attrs);
20 | }
21 |
22 | public ChatBubbleLayout(Context context, AttributeSet attrs, int defStyleAttr) {
23 | super(context, attrs, defStyleAttr);
24 | }
25 |
26 | public void setChatBubbleColor(int color){
27 | setBubbleColor(color);
28 | }
29 |
30 | public void setChatArrowDirection(ArrowDirection direction) {
31 | setArrowDirection(direction);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/jniLibs/armeabi/libaiui.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/AIUIChatDemo/app/src/main/jniLibs/armeabi/libaiui.so
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/anim/anim_wave.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
15 |
20 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/anim/slide_left_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
13 |
14 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/anim/slide_left_out.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
13 |
14 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/anim/slide_right_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
13 |
14 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/anim/slide_right_out.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
13 |
14 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/drawable-v21/ic_menu_manage.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/drawable-xhdpi/icon_chat_voice.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/AIUIChatDemo/app/src/main/res/drawable-xhdpi/icon_chat_voice.png
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/drawable-xhdpi/icon_keyboard.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/AIUIChatDemo/app/src/main/res/drawable-xhdpi/icon_keyboard.png
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/drawable-xhdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/AIUIChatDemo/app/src/main/res/drawable-xhdpi/logo.png
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/drawable-xxhdpi/aiui.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/AIUIChatDemo/app/src/main/res/drawable-xxhdpi/aiui.png
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/drawable-xxhdpi/insight.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/AIUIChatDemo/app/src/main/res/drawable-xxhdpi/insight.png
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/drawable-xxhdpi/user.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/AIUIChatDemo/app/src/main/res/drawable-xxhdpi/user.png
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/drawable/corners_edit.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
9 |
10 |
15 |
16 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/drawable/corners_edit_white.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
9 |
10 |
15 |
16 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/drawable/ic_feedback_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/drawable/ic_info_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/drawable/ic_pause_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/drawable/ic_play_arrow_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/drawable/ic_report_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/drawable/ic_settings_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/drawable/ic_skip_next_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/drawable/ic_skip_previous_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/drawable/record_microphone.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | -
5 |
6 |
7 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/drawable/record_microphone_bj.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
7 |
8 |
10 |
11 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/drawable/send_btn_back.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
9 |
10 |
15 |
16 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/drawable/side_nav_bar.xml:
--------------------------------------------------------------------------------
1 |
3 |
9 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/layout/about_fragment.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
23 |
24 |
36 |
37 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
14 |
15 |
19 |
20 |
26 |
27 |
28 |
33 |
34 |
35 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/layout/appid_key_preference.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
13 |
14 |
22 |
23 |
24 |
25 |
28 |
29 |
37 |
38 |
39 |
40 |
43 |
44 |
52 |
53 |
54 |
55 |
61 |
62 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/layout/detail_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
10 |
11 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/layout/layout_microphone.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
14 |
15 |
20 |
21 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/layout/nav_header_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
24 |
25 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/menu/drawer.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/AIUIChatDemo/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/mipmap-xhdpi/icon_chat_add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/AIUIChatDemo/app/src/main/res/mipmap-xhdpi/icon_chat_add.png
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/mipmap-xhdpi/icon_chat_expression.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/AIUIChatDemo/app/src/main/res/mipmap-xhdpi/icon_chat_expression.png
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/mipmap-xhdpi/icon_chat_photo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/AIUIChatDemo/app/src/main/res/mipmap-xhdpi/icon_chat_photo.png
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/mipmap-xhdpi/icon_chat_photograph.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/AIUIChatDemo/app/src/main/res/mipmap-xhdpi/icon_chat_photograph.png
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/mipmap-xhdpi/icon_chat_voice.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/AIUIChatDemo/app/src/main/res/mipmap-xhdpi/icon_chat_voice.png
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/mipmap-xhdpi/icon_keyboard.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/AIUIChatDemo/app/src/main/res/mipmap-xhdpi/icon_keyboard.png
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/mipmap-xhdpi/icon_voice_left1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/AIUIChatDemo/app/src/main/res/mipmap-xhdpi/icon_voice_left1.png
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/mipmap-xhdpi/icon_voice_left2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/AIUIChatDemo/app/src/main/res/mipmap-xhdpi/icon_voice_left2.png
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/mipmap-xhdpi/icon_voice_left3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/AIUIChatDemo/app/src/main/res/mipmap-xhdpi/icon_voice_left3.png
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/mipmap-xhdpi/icon_voice_right1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/AIUIChatDemo/app/src/main/res/mipmap-xhdpi/icon_voice_right1.png
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/mipmap-xhdpi/icon_voice_right2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/AIUIChatDemo/app/src/main/res/mipmap-xhdpi/icon_voice_right2.png
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/mipmap-xhdpi/icon_voice_right3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/AIUIChatDemo/app/src/main/res/mipmap-xhdpi/icon_voice_right3.png
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/mipmap-xhdpi/record_bottom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/AIUIChatDemo/app/src/main/res/mipmap-xhdpi/record_bottom.png
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/mipmap-xhdpi/record_top.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/AIUIChatDemo/app/src/main/res/mipmap-xhdpi/record_top.png
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/values-zh-rCN/values-zh-rCN.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | AIUI
4 |
5 | Open navigation drawer
6 | Close navigation drawer
7 | 快说\"小飞小飞\"唤醒我吧
8 |
9 | 按住说话
10 | 松开结束
11 |
12 | 反馈
13 | 设置
14 | 关于
15 |
16 | 交互
17 | 唤醒
18 | 通过唤醒+命令进行交互
19 | 前端点
20 | 语音后端点时间
21 | 后端点有效值应为数字
22 |
23 | 调试
24 | 输出调试日志
25 | 在Logcat中打印运行日志
26 | 保存交互音频
27 | 在SD卡中保存交互的音频与结果日志
28 | 高级
29 | AppID设置
30 | 使用新的AppID和Key
31 | AppID
32 | Key
33 | 清空AppID及Key可恢复默认
34 | Scene
35 |
36 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/values/attr.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FFFFFF
4 | #000000
5 | #9E9E9E
6 |
7 | #FFFFFF
8 | #000000
9 | #69d3fe
10 | #FFFFFF
11 | #818181
12 | #1990ff
13 |
14 |
15 |
16 | #f5f5f5
17 | #d9d9d9
18 |
19 |
20 | #1b1b1b
21 | #3084a7
22 | #455A64
23 | #818181
24 | #919191
25 | #c7c7c7
26 | #404040
27 | #F000
28 |
29 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 | 16dp
6 | 160dp
7 | 16dp
8 |
9 | 10dp
10 | 10dp
11 | 64dp
12 | 6dp
13 | 1dp
14 | 5dp
15 | 10dp
16 | 40dp
17 |
18 | 19sp
19 | 17sp
20 | 15sp
21 | 13sp
22 | 1dp
23 | 6dp
24 |
25 | 8dp
26 |
27 |
28 |
29 | 2dp
30 | 4dp
31 | 8dp
32 | 16dp
33 | 32dp
34 |
35 |
36 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/values/drawables.xml:
--------------------------------------------------------------------------------
1 |
2 | - @android:drawable/ic_menu_camera
3 | - @android:drawable/ic_menu_gallery
4 | - @android:drawable/ic_menu_slideshow
5 | - @android:drawable/ic_menu_manage
6 | - @android:drawable/ic_menu_share
7 | - @android:drawable/ic_menu_send
8 | - @android:drawable/ic_menu_info_details
9 |
10 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/values/integers.xml:
--------------------------------------------------------------------------------
1 |
2 | 200
3 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | AIUI
3 |
4 | Open navigation drawer
5 | Close navigation drawer
6 | 快说\"小飞小飞\"唤醒我吧
7 |
8 | 按住说话
9 | 松开结束
10 |
11 | 反馈
12 | 设置
13 | 关于
14 |
15 | 交互
16 | 唤醒
17 | 通过唤醒+命令进行交互
18 | 前端点
19 | 语音后端点时间
20 | 后端点有效值应为数字
21 |
22 | 调试
23 | 输出调试日志
24 | 在Logcat中打印运行日志
25 | 保存交互音频
26 | 在SD卡中保存交互的音频与结果日志
27 | 高级
28 | AppID设置
29 | 使用新的AppID和Key
30 | AppID
31 | Key
32 | 清空AppID及Key可恢复默认
33 | Scene
34 |
35 |
36 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
12 |
13 |
17 |
18 |
24 |
25 |
27 |
28 |
31 |
32 |
38 |
39 |
45 |
46 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/xml/filepaths.xml:
--------------------------------------------------------------------------------
1 |
22 |
23 |
25 |
28 |
29 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/main/res/xml/pref_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
12 |
13 |
19 |
20 |
21 |
23 |
24 |
29 |
30 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/sample/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
7 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/sample/java/com/iflytek/aiui/demo/chat/di/AppComponent.java:
--------------------------------------------------------------------------------
1 | package com.iflytek.aiui.demo.chat.di;
2 |
3 | import android.app.Application;
4 |
5 | import com.iflytek.aiui.demo.chat.ChatApp;
6 |
7 | import javax.inject.Singleton;
8 |
9 | import dagger.BindsInstance;
10 | import dagger.Component;
11 | import dagger.android.AndroidInjectionModule;
12 |
13 | /**
14 | * Created by PR on 2017/11/6.
15 | */
16 |
17 | @Singleton
18 | @Component(modules = {
19 | AndroidInjectionModule.class,
20 | AppModule.class,
21 | ChatActivityModule.class
22 | })
23 |
24 | public interface AppComponent {
25 | @Component.Builder
26 | interface Builder {
27 | @BindsInstance
28 | Builder application(Application application);
29 | AppComponent build();
30 | }
31 | void inject(ChatApp application);
32 | }
33 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/sample/java/com/iflytek/aiui/demo/chat/di/FragmentBuildersModule.java:
--------------------------------------------------------------------------------
1 | package com.iflytek.aiui.demo.chat.di;
2 |
3 | import com.iflytek.aiui.demo.chat.ui.about.AboutFragment;
4 | import com.iflytek.aiui.demo.chat.ui.chat.ChatFragment;
5 | import com.iflytek.aiui.demo.chat.ui.detail.DetailFragment;
6 | import com.iflytek.aiui.demo.chat.ui.settings.SettingsFragment;
7 |
8 | import dagger.Module;
9 | import dagger.android.ContributesAndroidInjector;
10 |
11 | /**
12 | * Created by PR on 2018/1/22.
13 | */
14 |
15 | @Module
16 | public abstract class FragmentBuildersModule {
17 | @ContributesAndroidInjector
18 | abstract ChatFragment contributesChatFragment( );
19 |
20 | @ContributesAndroidInjector
21 | abstract DetailFragment contributeDetailFragment( );
22 |
23 | @ContributesAndroidInjector
24 | abstract AboutFragment contributeAboutFragment();
25 |
26 | @ContributesAndroidInjector
27 | abstract SettingsFragment contributeSettingFragment( );
28 | }
29 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/sample/java/com/iflytek/aiui/demo/chat/di/ViewModelModule.java:
--------------------------------------------------------------------------------
1 | package com.iflytek.aiui.demo.chat.di;
2 |
3 | import android.arch.lifecycle.ViewModel;
4 | import android.arch.lifecycle.ViewModelProvider;
5 |
6 | import com.iflytek.aiui.demo.chat.ui.about.AboutViewModel;
7 | import com.iflytek.aiui.demo.chat.ui.chat.ChatViewModel;
8 | import com.iflytek.aiui.demo.chat.ui.chat.PlayerViewModel;
9 | import com.iflytek.aiui.demo.chat.ui.settings.SettingViewModel;
10 | import com.iflytek.aiui.demo.chat.ui.ViewModelFactory;
11 |
12 | import dagger.Binds;
13 | import dagger.Module;
14 | import dagger.multibindings.IntoMap;
15 |
16 | @Module
17 | public abstract class ViewModelModule {
18 | @Binds
19 | @IntoMap
20 | @ViewModelKey(ChatViewModel.class)
21 | abstract ViewModel buildChatViewModel(ChatViewModel messagesViewModel);
22 |
23 | @Binds
24 | @IntoMap
25 | @ViewModelKey(PlayerViewModel.class)
26 | abstract ViewModel buildPlayerViewModel(PlayerViewModel playerViewModel);
27 |
28 | @Binds
29 | @IntoMap
30 | @ViewModelKey(SettingViewModel.class)
31 | abstract ViewModel buildSettingsViewModel(SettingViewModel settingViewModel);
32 |
33 | @Binds
34 | @IntoMap
35 | @ViewModelKey(AboutViewModel.class)
36 | abstract ViewModel buildAboutViewModel(AboutViewModel aboutViewModel);
37 |
38 | @Binds
39 | abstract ViewModelProvider.Factory bindViewModelFactory(ViewModelFactory factory);
40 | }
41 |
--------------------------------------------------------------------------------
/AIUIChatDemo/app/src/sample/java/com/iflytek/aiui/demo/chat/util/FucUtil.java:
--------------------------------------------------------------------------------
1 | package com.iflytek.aiui.demo.chat.util;
2 |
3 | import android.content.Context;
4 |
5 |
6 |
7 | import java.io.InputStream;
8 |
9 | /**
10 | * 功能性函数扩展类
11 | */
12 | public class FucUtil {
13 | /**
14 | * 读取asset目录下文件。
15 | * @return content
16 | */
17 | public static String readFile(Context mContext, String file, String code)
18 | {
19 | int len = 0;
20 | byte []buf = null;
21 | String result = "";
22 | try {
23 | InputStream in = mContext.getAssets().open(file);
24 | len = in.available();
25 | buf = new byte[len];
26 | in.read(buf, 0, len);
27 |
28 | result = new String(buf,code);
29 | } catch (Exception e) {
30 | e.printStackTrace();
31 | }
32 | return result;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/AIUIChatDemo/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | google()
7 | }
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:3.0.1'
10 |
11 | // NOTE: Do not place your application dependencies here; they belong
12 | // in the individual module build.gradle files
13 | }
14 | }
15 |
16 | allprojects {
17 | repositories {
18 | jcenter()
19 | maven { url 'https://dl.google.com/dl/android/maven2/' }
20 | maven {
21 | url 'http://maven.aliyun.com/nexus/content/repositories/releases/'
22 | }
23 | maven { url 'https://jitpack.io' }
24 | }
25 | }
26 |
27 | task prepareSample {
28 | doLast {
29 | copy {
30 | from project.projectDir
31 | into 'output/sample'
32 |
33 | // 忽略签名文件
34 | exclude 'iflytekSigneKey'
35 | exclude 'local.properties'
36 | exclude 'gradle.properties'
37 | //去除full的配置
38 | exclude '**/full.gradle'
39 | exclude '**/full/'
40 | exclude '**/smtp_mail_library/'
41 | // 忽略AIUI生成目录
42 | exclude '**/output/'
43 | // 忽略gradle生成目录
44 | exclude '**/*.apk', '**/*.ap_', '**/*.dex', '**/*.class'
45 | exclude '**/bin/', '**/gen/', '**/out/', '**/build/', '**/proguard/'
46 | exclude '**/*.iml', '**/.gradle/', '**/.idea/', '**/.externalNativeBuild/', '**/.navigation/'
47 | }
48 |
49 | File settingsFile = file('output/sample/settings.gradle')
50 | settingsFile.text = "include ':app'"
51 |
52 | File sampleBuildFile = file('output/sample/app/build.gradle')
53 | sampleBuildFile.text = sampleBuildFile.text.replace("apply from: 'full.gradle'", "")
54 |
55 | File config = file('output/sample/app/src/main/assets/cfg/aiui_phone.cfg')
56 | String configContent = config.text
57 | configContent = configContent.replace('56ac196f', 'XXXXXXXX')
58 | configContent = configContent.replace('nlp31', 'main')
59 | configContent = configContent.replace('"dwa": "wpgs"', '')
60 | config.write(configContent, 'utf-8')
61 |
62 | }
63 | }
64 |
65 | task clean(type: Delete) {
66 | delete rootProject.buildDir
67 | }
68 |
--------------------------------------------------------------------------------
/AIUIChatDemo/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/AIUIChatDemo/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/AIUIChatDemo/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Thu Jan 04 11:06:15 CST 2018
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
7 |
--------------------------------------------------------------------------------
/AIUIChatDemo/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/AIUIChatDemo/screenshots/call_upload.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/AIUIChatDemo/screenshots/call_upload.jpg
--------------------------------------------------------------------------------
/AIUIChatDemo/screenshots/call_use.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/AIUIChatDemo/screenshots/call_use.jpg
--------------------------------------------------------------------------------
/AIUIChatDemo/screenshots/menu_item.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/AIUIChatDemo/screenshots/menu_item.png
--------------------------------------------------------------------------------
/AIUIChatDemo/screenshots/menu_skill.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/AIUIChatDemo/screenshots/menu_skill.png
--------------------------------------------------------------------------------
/AIUIChatDemo/screenshots/menu_upload.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/AIUIChatDemo/screenshots/menu_upload.jpg
--------------------------------------------------------------------------------
/AIUIChatDemo/screenshots/menu_use.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/AIUIChatDemo/screenshots/menu_use.jpg
--------------------------------------------------------------------------------
/AIUIChatDemo/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # DemoCode
2 | AIUI demo code
3 |
4 | 国内用户可从 https://gitee.com/xiaosumay/DemoCode 镜像处下载
5 |
--------------------------------------------------------------------------------
/aiui/c-sharp/.gitignore:
--------------------------------------------------------------------------------
1 | .vs
2 | *.cache
--------------------------------------------------------------------------------
/aiui/c-sharp/README.txt:
--------------------------------------------------------------------------------
1 | 1. 将平台下载的 aiui 库(aiui.dll)放在 aiui_csharp_demo 目录下,建议x64,且重新命名为
2 | 2. 修改 AIUI/cfg/aiui.cfg 下的 appid 和 key
3 | 3. 将 【调试】 -> 【aiui_csharp_demo 属性】 -> 【调试】 -> 【工作目录】 设置为 ..\..\..
4 | 4. 即可运行调试
--------------------------------------------------------------------------------
/aiui/c-sharp/aiui_csharp_demo.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "aiui_csharp_demo", "aiui_csharp_demo\aiui_csharp_demo.csproj", "{878279F9-9616-4547-A589-D1C993086DF8}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Debug|x64 = Debug|x64
12 | Debug|x86 = Debug|x86
13 | Release|Any CPU = Release|Any CPU
14 | Release|x64 = Release|x64
15 | Release|x86 = Release|x86
16 | EndGlobalSection
17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
18 | {878279F9-9616-4547-A589-D1C993086DF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19 | {878279F9-9616-4547-A589-D1C993086DF8}.Debug|Any CPU.Build.0 = Debug|Any CPU
20 | {878279F9-9616-4547-A589-D1C993086DF8}.Debug|x64.ActiveCfg = Debug|x64
21 | {878279F9-9616-4547-A589-D1C993086DF8}.Debug|x64.Build.0 = Debug|x64
22 | {878279F9-9616-4547-A589-D1C993086DF8}.Debug|x86.ActiveCfg = Debug|x86
23 | {878279F9-9616-4547-A589-D1C993086DF8}.Debug|x86.Build.0 = Debug|x86
24 | {878279F9-9616-4547-A589-D1C993086DF8}.Release|Any CPU.ActiveCfg = Release|Any CPU
25 | {878279F9-9616-4547-A589-D1C993086DF8}.Release|Any CPU.Build.0 = Release|Any CPU
26 | {878279F9-9616-4547-A589-D1C993086DF8}.Release|x64.ActiveCfg = Release|x64
27 | {878279F9-9616-4547-A589-D1C993086DF8}.Release|x64.Build.0 = Release|x64
28 | {878279F9-9616-4547-A589-D1C993086DF8}.Release|x86.ActiveCfg = Release|x86
29 | {878279F9-9616-4547-A589-D1C993086DF8}.Release|x86.Build.0 = Release|x86
30 | EndGlobalSection
31 | GlobalSection(SolutionProperties) = preSolution
32 | HideSolutionNode = FALSE
33 | EndGlobalSection
34 | GlobalSection(ExtensibilityGlobals) = postSolution
35 | SolutionGuid = {8A116986-897B-4D3D-9E14-F424818D5450}
36 | EndGlobalSection
37 | EndGlobal
38 |
--------------------------------------------------------------------------------
/aiui/c-sharp/aiui_csharp_demo/.gitignore:
--------------------------------------------------------------------------------
1 | /*.user
2 | /obj
3 | /bin
4 | aiui.dll
5 | *.suo
--------------------------------------------------------------------------------
/aiui/c-sharp/aiui_csharp_demo/AIUI/audio/test.pcm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/aiui/c-sharp/aiui_csharp_demo/AIUI/audio/test.pcm
--------------------------------------------------------------------------------
/aiui/c-sharp/aiui_csharp_demo/AIUI/cfg/aiui.cfg:
--------------------------------------------------------------------------------
1 | /* AIUI参数配置 */
2 | {
3 | /* 交互参数 */
4 | "interact": {
5 | "interact_timeout": "-1",
6 | "result_timeout": "5000"
7 | },
8 |
9 | /* 全局设置 */
10 | "global": {
11 | "scene": "main_box"
12 | },
13 |
14 | "login": {
15 | "appid": "xxxxxxx",
16 | "key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
17 | },
18 |
19 | /* 业务相关参数 */
20 | // 本地vad参数
21 | "vad": {
22 | "engine_type": "meta"
23 | },
24 |
25 | /* 业务流程相关参数 */
26 | // 语音业务流程
27 | "speech": {
28 | "data_source": "sdk",
29 | "wakeup_mode": "off",
30 | "interact_mode": "continuous", // continuous
31 | "intent_engine_type": "cloud",
32 | "audio_captor": "system"
33 | },
34 |
35 | /* 日志设置 */
36 | "log": {
37 | "debug_log": "0",
38 | "save_datalog": "0",
39 | "datalog_path": "",
40 | "datalog_size": 1024,
41 | "raw_audio_path": ""
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/aiui/c-sharp/aiui_csharp_demo/IAIUIAgent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace aiui
5 | {
6 | class IAIUIAgent
7 | {
8 | public delegate void AIUIMessageCallback(IAIUIEvent ev);
9 |
10 | private IntPtr mAgent = IntPtr.Zero;
11 |
12 | private AIUIMessageCallback messageCallback = null;
13 | private AIUIMessageCallback_ onEvent_ = null;
14 |
15 | private void OnEvent(IntPtr ev_, IntPtr data)
16 | {
17 | IAIUIEvent ev = new IAIUIEvent(ev_);
18 | messageCallback?.Invoke(ev);
19 | ev = null;
20 | }
21 |
22 | private IAIUIAgent(string param, AIUIMessageCallback cb)
23 | {
24 | if (IntPtr.Zero == mAgent)
25 | {
26 | messageCallback = cb;
27 | onEvent_ = new AIUIMessageCallback_(OnEvent);
28 | mAgent = aiui_agent_create(Marshal.StringToHGlobalAnsi(param), onEvent_, IntPtr.Zero);
29 | }
30 | }
31 |
32 | public static IAIUIAgent Create(string param, AIUIMessageCallback cb)
33 | {
34 | return new IAIUIAgent(param, cb);
35 | }
36 |
37 | public void SendMessage(IAIUIMessage msg)
38 | {
39 | if (IntPtr.Zero != mAgent)
40 | aiui_agent_send_message(mAgent, msg.Ptr);
41 | }
42 |
43 | ~IAIUIAgent()
44 | {
45 | Destroy();
46 | }
47 |
48 | public void Destroy()
49 | {
50 | if (IntPtr.Zero != mAgent)
51 | {
52 | aiui_agent_destroy(mAgent);
53 | mAgent = IntPtr.Zero;
54 | }
55 |
56 | messageCallback = null;
57 | onEvent_ = null;
58 | }
59 |
60 | public static string Version()
61 | {
62 | IntPtr temp = aiui_get_version();
63 | string res = Marshal.PtrToStringAnsi(temp).ToString();
64 | temp = IntPtr.Zero;
65 |
66 | return res;
67 | }
68 |
69 | [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
70 | private delegate void AIUIMessageCallback_(IntPtr ev, IntPtr data);
71 |
72 | [DllImport("aiui", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
73 | private extern static IntPtr aiui_agent_create(IntPtr param, AIUIMessageCallback_ cb, IntPtr data);
74 |
75 | [DllImport("aiui", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
76 | private extern static void aiui_agent_send_message(IntPtr agent, IntPtr msg);
77 |
78 | [DllImport("aiui", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
79 | private extern static void aiui_agent_destroy(IntPtr agent);
80 |
81 | [DllImport("aiui", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
82 | private extern static IntPtr aiui_get_version();
83 | }
84 | }
--------------------------------------------------------------------------------
/aiui/c-sharp/aiui_csharp_demo/IAIUIBuffer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace aiui
5 | {
6 | class IBuffer
7 | {
8 | public IntPtr mData;
9 |
10 | private IBuffer(IntPtr data)
11 | {
12 | mData = data;
13 | }
14 |
15 | public static readonly IBuffer Zero = new IBuffer(IntPtr.Zero);
16 |
17 | public static IBuffer FromData(byte[] data, int len)
18 | {
19 | IntPtr tmp = aiui_create_buffer_from_data(ref data[0], len);
20 | return new IBuffer(tmp);
21 | }
22 |
23 | ~IBuffer()
24 | {
25 | mData = IntPtr.Zero;
26 | }
27 |
28 | [DllImport("aiui", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
29 | private static extern IntPtr aiui_create_buffer_from_data(ref byte data, int len);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/aiui/c-sharp/aiui_csharp_demo/IAIUIEvent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace aiui
5 | {
6 | class IAIUIEvent
7 | {
8 | private IntPtr mEvent;
9 | private IDataBundle mBundle;
10 |
11 | public IAIUIEvent(IntPtr ev)
12 | {
13 | mEvent = ev;
14 | mBundle = new IDataBundle(aiui_event_databundle(mEvent));
15 | }
16 |
17 | public int GetEventType()
18 | {
19 | return aiui_event_type(mEvent);
20 | }
21 |
22 | public int GetArg1()
23 | {
24 | return aiui_event_arg1(mEvent);
25 | }
26 |
27 | public int GetArg2()
28 | {
29 | return aiui_event_arg2(mEvent);
30 | }
31 |
32 | public string GetInfo()
33 | {
34 | IntPtr temp = aiui_event_info(mEvent);
35 | string info = Marshal.PtrToStringAnsi(temp).ToString();
36 | temp = IntPtr.Zero;
37 |
38 | return info;
39 | }
40 |
41 | ~IAIUIEvent()
42 | {
43 | mEvent = IntPtr.Zero;
44 | mBundle = null;
45 | }
46 |
47 | public IDataBundle GetData()
48 | {
49 | return mBundle;
50 | }
51 |
52 | [DllImport("aiui", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
53 | private static extern int aiui_event_type(IntPtr ev);
54 |
55 | [DllImport("aiui", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
56 | private static extern int aiui_event_arg1(IntPtr ev);
57 |
58 | [DllImport("aiui", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
59 | private static extern int aiui_event_arg2(IntPtr ev);
60 |
61 | [DllImport("aiui", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
62 | private static extern IntPtr aiui_event_info(IntPtr ev);
63 |
64 | [DllImport("aiui", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
65 | private static extern IntPtr aiui_event_databundle(IntPtr ev);
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/aiui/c-sharp/aiui_csharp_demo/IAIUIMessage.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace aiui
5 | {
6 | class IAIUIMessage
7 | {
8 | public IntPtr Ptr;
9 |
10 | private IAIUIMessage(IntPtr ptr)
11 | {
12 | Ptr = ptr;
13 | }
14 |
15 | public static IAIUIMessage Create(int msgType, int arg1, int arg2, string param, IBuffer data)
16 | {
17 | IntPtr tmp = aiui_msg_create(msgType, arg1, arg2, Marshal.StringToHGlobalAnsi(param), data.mData);
18 | return new IAIUIMessage(tmp);
19 | }
20 |
21 | ~IAIUIMessage()
22 | {
23 | Destroy();
24 | }
25 |
26 | public void Destroy()
27 | {
28 | if (Ptr != IntPtr.Zero)
29 | {
30 | aiui_msg_destroy(Ptr);
31 | Ptr = IntPtr.Zero;
32 | }
33 | }
34 |
35 | [DllImport("aiui", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
36 | private static extern IntPtr aiui_msg_create(int msgType, int arg1, int arg2, IntPtr param, IntPtr data);
37 |
38 | [DllImport("aiui", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
39 | private static extern void aiui_msg_destroy(IntPtr msg);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/aiui/c-sharp/aiui_csharp_demo/IDataBundle.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace aiui
5 | {
6 | class IDataBundle
7 | {
8 | public IntPtr mDataBundle;
9 |
10 | public IDataBundle(IntPtr db)
11 | {
12 | mDataBundle = db;
13 | }
14 |
15 | public int GetInt(string key, int defVal)
16 | {
17 | return aiui_db_int(mDataBundle, Marshal.StringToHGlobalAnsi(key), defVal);
18 | }
19 |
20 | public string GetString(string key, string defVal)
21 | {
22 | IntPtr tmp = aiui_db_string(mDataBundle, Marshal.StringToHGlobalAnsi(key), Marshal.StringToHGlobalAnsi(defVal));
23 |
24 | return Marshal.PtrToStringAnsi(tmp);
25 | }
26 |
27 | public byte[] GetBinary(string key, ref int len)
28 | {
29 | IntPtr tmp = aiui_db_binary(mDataBundle, Marshal.StringToHGlobalAnsi(key), ref len);
30 |
31 | byte[] managedArray = new byte[len];
32 | Marshal.Copy(tmp, managedArray, 0, len);
33 |
34 | return managedArray;
35 | }
36 |
37 | ~IDataBundle()
38 | {
39 | mDataBundle = IntPtr.Zero;
40 | }
41 |
42 | [DllImport("aiui", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
43 | private static extern int aiui_db_int(IntPtr db, IntPtr key, int defVal);
44 |
45 | [DllImport("aiui", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
46 | private static extern IntPtr aiui_db_string(IntPtr db, IntPtr key, IntPtr defVal);
47 |
48 | [DllImport("aiui", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
49 | private static extern IntPtr aiui_db_binary(IntPtr db, IntPtr key, ref int len);
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/aiui/c-sharp/aiui_csharp_demo/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("aiui_csharp_demo")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("aiui_csharp_demo")]
13 | [assembly: AssemblyCopyright("Copyright © 2020")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("878279f9-9616-4547-a589-d1c993086df8")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/aiui/c-sharp/aiui_csharp_demo/aiui_csharp_demo.csproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | ..\..\..\
5 |
6 |
7 | publish\
8 |
9 |
10 |
11 |
12 |
13 | en-US
14 | false
15 | ShowAllFiles
16 |
17 |
18 | ..\..\..\
19 |
20 |
21 | ..\..\..\
22 |
23 |
--------------------------------------------------------------------------------
/aiui/c-sharp/aiui_csharp_demo/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/aiui/c-sharp/aiui_csharp_demo/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/aiui/c-sharp/packages/NAudio.1.9.0/.signature.p7s:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/aiui/c-sharp/packages/NAudio.1.9.0/.signature.p7s
--------------------------------------------------------------------------------
/aiui/c-sharp/packages/NAudio.1.9.0/NAudio.1.9.0.nupkg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/aiui/c-sharp/packages/NAudio.1.9.0/NAudio.1.9.0.nupkg
--------------------------------------------------------------------------------
/aiui/c-sharp/packages/NAudio.1.9.0/lib/net35/NAudio.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/aiui/c-sharp/packages/NAudio.1.9.0/lib/net35/NAudio.dll
--------------------------------------------------------------------------------
/aiui/c-sharp/packages/NAudio.1.9.0/lib/netstandard2.0/NAudio.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/aiui/c-sharp/packages/NAudio.1.9.0/lib/netstandard2.0/NAudio.dll
--------------------------------------------------------------------------------
/aiui/c-sharp/packages/NAudio.1.9.0/lib/uap10.0.10240/NAudio.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/aiui/c-sharp/packages/NAudio.1.9.0/lib/uap10.0.10240/NAudio.dll
--------------------------------------------------------------------------------
/aiui/c-sharp/packages/NAudio.1.9.0/lib/uap10.0.10240/NAudio.pri:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/aiui/c-sharp/packages/NAudio.1.9.0/lib/uap10.0.10240/NAudio.pri
--------------------------------------------------------------------------------
/aiui/c-sharp/packages/Newtonsoft.Json.13.0.1/.signature.p7s:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/aiui/c-sharp/packages/Newtonsoft.Json.13.0.1/.signature.p7s
--------------------------------------------------------------------------------
/aiui/c-sharp/packages/Newtonsoft.Json.13.0.1/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2007 James Newton-King
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | this software and associated documentation files (the "Software"), to deal in
7 | the Software without restriction, including without limitation the rights to
8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | the Software, and to permit persons to whom the Software is furnished to do so,
10 | subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/aiui/c-sharp/packages/Newtonsoft.Json.13.0.1/Newtonsoft.Json.13.0.1.nupkg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/aiui/c-sharp/packages/Newtonsoft.Json.13.0.1/Newtonsoft.Json.13.0.1.nupkg
--------------------------------------------------------------------------------
/aiui/c-sharp/packages/Newtonsoft.Json.13.0.1/lib/net20/Newtonsoft.Json.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/aiui/c-sharp/packages/Newtonsoft.Json.13.0.1/lib/net20/Newtonsoft.Json.dll
--------------------------------------------------------------------------------
/aiui/c-sharp/packages/Newtonsoft.Json.13.0.1/lib/net35/Newtonsoft.Json.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/aiui/c-sharp/packages/Newtonsoft.Json.13.0.1/lib/net35/Newtonsoft.Json.dll
--------------------------------------------------------------------------------
/aiui/c-sharp/packages/Newtonsoft.Json.13.0.1/lib/net40/Newtonsoft.Json.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/aiui/c-sharp/packages/Newtonsoft.Json.13.0.1/lib/net40/Newtonsoft.Json.dll
--------------------------------------------------------------------------------
/aiui/c-sharp/packages/Newtonsoft.Json.13.0.1/lib/net45/Newtonsoft.Json.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/aiui/c-sharp/packages/Newtonsoft.Json.13.0.1/lib/net45/Newtonsoft.Json.dll
--------------------------------------------------------------------------------
/aiui/c-sharp/packages/Newtonsoft.Json.13.0.1/lib/netstandard1.0/Newtonsoft.Json.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/aiui/c-sharp/packages/Newtonsoft.Json.13.0.1/lib/netstandard1.0/Newtonsoft.Json.dll
--------------------------------------------------------------------------------
/aiui/c-sharp/packages/Newtonsoft.Json.13.0.1/lib/netstandard1.3/Newtonsoft.Json.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/aiui/c-sharp/packages/Newtonsoft.Json.13.0.1/lib/netstandard1.3/Newtonsoft.Json.dll
--------------------------------------------------------------------------------
/aiui/c-sharp/packages/Newtonsoft.Json.13.0.1/lib/netstandard2.0/Newtonsoft.Json.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/aiui/c-sharp/packages/Newtonsoft.Json.13.0.1/lib/netstandard2.0/Newtonsoft.Json.dll
--------------------------------------------------------------------------------
/aiui/c-sharp/packages/Newtonsoft.Json.13.0.1/packageIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/aiui/c-sharp/packages/Newtonsoft.Json.13.0.1/packageIcon.png
--------------------------------------------------------------------------------
/aiui/c/AIUI/audio/weather.pcm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/aiui/c/AIUI/audio/weather.pcm
--------------------------------------------------------------------------------
/aiui/c/AIUI/cfg/aiui.cfg:
--------------------------------------------------------------------------------
1 | /* AIUI参数配置 */
2 | {
3 | /* 交互参数 */
4 | "interact": {
5 | "interact_timeout": "-1",
6 | "result_timeout": "5000"
7 | },
8 | /* 全局设置 */
9 | "global": {
10 | "scene": "main_box"
11 | },
12 |
13 | "login": {
14 | "appid": "xxxxxxxx"
15 | },
16 |
17 | /* 业务相关参数 */
18 | // 本地vad参数
19 | "vad": {
20 | "engine_type": "meta"
21 | },
22 | // 识别(音频输入)参数
23 | "iat": {
24 | "sample_rate": "16000"
25 | },
26 | /* 业务流程相关参数 */
27 | // 语音业务流程
28 | "speech": {
29 | "data_source": "sdk",
30 | "wakeup_mode": "off",
31 | "interact_mode": "continuous",
32 | "intent_engine_type": "cloud"
33 | },
34 |
35 | /* 日志设置 */
36 | "log": {
37 | "debug_log": "1",
38 | "save_datalog": "0",
39 | "datalog_path": ".",
40 | "datalog_size": 1024,
41 | "raw_audio_path": ""
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/aiui/c/README.txt:
--------------------------------------------------------------------------------
1 | 1. 将在平台下载的aiui库放在此目录下
2 | 2. gcc main.c -o main -L. -Iinclude -laiui -Wl,-rpath,'$ORIGIN' -Werror
3 | 3. 修改 AIUI/cfg/aiui.cfg 下的 appid
--------------------------------------------------------------------------------
/aiui/c/include/aiui/AIUICommon.h:
--------------------------------------------------------------------------------
1 | #ifndef AIUI_COMMON_HDR_X2342Y3
2 | #define AIUI_COMMON_HDR_X2342Y3
3 |
4 | #if defined(WIN32)
5 | # ifndef AIUI_WINDOWS
6 | # define AIUI_WINDOWS
7 | # endif
8 | #endif
9 |
10 | #if defined(AIUI_WINDOWS)
11 | # if !defined(__MINGW32__)
12 | typedef long ssize_t;
13 | typedef unsigned long pid_t;
14 | # endif
15 |
16 | # undef AIUIEXPORT
17 | # if defined(AIUI_LIB_COMPILING)
18 | # define AIUI_DEPRECATED __declspec(deprecated)
19 | # define AIUIEXPORT __declspec(dllexport)
20 | # define AIUIHIDDEN
21 | # define AIUIAPI __stdcall
22 | # else
23 | # define AIUI_DEPRECATED __declspec(deprecated)
24 | # define AIUIEXPORT
25 | # define AIUIHIDDEN
26 | # define AIUIAPI __stdcall
27 | # endif
28 | #else
29 | # undef AIUIEXPORT
30 | # define AIUI_DEPRECATED __attribute__((deprecated))
31 | # define AIUIEXPORT __attribute__((visibility("default")))
32 | # define AIUIHIDDEN __attribute__((visibility("hidden")))
33 | # undef AIUIAPI
34 | # define AIUIAPI
35 | #endif
36 |
37 | #ifndef __cplusplus
38 | # define __AIUI_PRFIX__(x) AIUI_##x
39 | # define AIUI_PRFIX(x) __AIUI_PRFIX__(x)
40 | #else
41 | # define AIUI_PRFIX(x) x
42 | #endif
43 | #endif
44 |
--------------------------------------------------------------------------------
/aiui/java/README.txt:
--------------------------------------------------------------------------------
1 | 1. 将平台下载的 aiui 库放在此目录下
2 | 2. 将平台下载中 Sample 目录下的 AIUI 拷贝至此
3 |
--------------------------------------------------------------------------------
/aiui/java/aiui-1.0.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/aiui/java/aiui-1.0.0.jar
--------------------------------------------------------------------------------
/aiui/python/AIUI/audio/test.pcm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/aiui/python/AIUI/audio/test.pcm
--------------------------------------------------------------------------------
/aiui/python/AIUI/cfg/aiui.cfg:
--------------------------------------------------------------------------------
1 | /* AIUI参数配置 */
2 | {
3 | /* 交互参数 */
4 | "interact": {
5 | "interact_timeout": "-1",
6 | "result_timeout": "5000"
7 | },
8 |
9 | /* 全局设置 */
10 | "global": {
11 | "scene": "main_box"
12 | },
13 |
14 | /* 请登录 https://aiui.xfyun.cn 查看应用 */
15 | "login": {
16 | "appid": "xxxxxxxx",
17 | "key": "xxxxxxxxxxxxxxxxx"
18 | },
19 |
20 | /* 业务相关参数 */
21 | // 本地vad参数
22 | "vad": {
23 | "engine_type": "meta"
24 | },
25 |
26 | // 识别(音频输入)参数
27 | "iat": {
28 | "sample_rate": "16000"
29 | },
30 |
31 | /* 业务流程相关参数 */
32 | // 语音业务流程
33 | "speech": {
34 | "data_source": "sdk",
35 | "interact_mode": "continous",
36 | "intent_engine_type": "cloud"
37 | },
38 |
39 | /* 日志设置 */
40 | "log": {
41 | "debug_log": "0",
42 | "save_datalog": "0",
43 | "datalog_path": "",
44 | "datalog_size": 1024,
45 | "raw_audio_path": ""
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/aiui/python/README.txt:
--------------------------------------------------------------------------------
1 | 1. 将平台下载的 aiui 库放在此目录下且重新命名为 aiui.dll
2 | 2. 修改 AIUI/cfg/aiui.cfg 下的 appid 和 key
3 | 3. 执行 python3 main.py
4 |
--------------------------------------------------------------------------------
/docs/.gitignore:
--------------------------------------------------------------------------------
1 | _build
2 | .vscode
--------------------------------------------------------------------------------
/docs/_static/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/docs/_static/.gitkeep
--------------------------------------------------------------------------------
/docs/_static/aiui.css:
--------------------------------------------------------------------------------
1 | .wy-nav-content {
2 | max-width: 1000px;
3 | }
--------------------------------------------------------------------------------
/docs/_static/screenshot_1519613427018.4507411a.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/docs/_static/screenshot_1519613427018.4507411a.png
--------------------------------------------------------------------------------
/docs/_templates/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/docs/_templates/.gitkeep
--------------------------------------------------------------------------------
/docs/index.rst:
--------------------------------------------------------------------------------
1 | .. _head_link:
2 |
3 | #############################
4 | AIUI语音SDK集成文档
5 | #############################
6 |
7 |
8 |
9 | .. toctree::
10 | :maxdepth: 2
11 | :glob:
12 |
13 | src/*
14 |
--------------------------------------------------------------------------------
/postprocess-demo/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | org.springframework.boot
7 | spring-boot-starter-parent
8 | 2.7.0
9 |
10 |
11 | com.iflytek.aiint
12 | postprocess-demo
13 | 0.0.1
14 | PostprocessDemo
15 | Demo project for Postprocess
16 |
17 | 1.8
18 |
19 |
20 |
21 | org.springframework.boot
22 | spring-boot-starter-web
23 |
24 |
25 |
26 | org.springframework.boot
27 | spring-boot-starter-test
28 | test
29 |
30 |
31 |
32 |
33 | com.alibaba
34 | fastjson
35 | 1.2.83
36 |
37 |
38 |
39 |
40 |
41 |
42 | org.springframework.boot
43 | spring-boot-maven-plugin
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/postprocess-demo/src/main/java/com/iflytek/aiint/demo/PostprocessDemoApplication.java:
--------------------------------------------------------------------------------
1 | package com.iflytek.aiint.demo;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class PostprocessDemoApplication {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(PostprocessDemoApplication.class, args);
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/postprocess-demo/src/main/resources/application.properties:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/postprocess-demo/src/main/resources/application.properties
--------------------------------------------------------------------------------
/postprocess-demo/src/test/java/com/iflytek/aiint/demo/PostprocessDemoApplicationTests.java:
--------------------------------------------------------------------------------
1 | package com.iflytek.aiint.demo;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class PostprocessDemoApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/webapi/doc/apikey.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/webapi/doc/apikey.png
--------------------------------------------------------------------------------
/webapi/doc/createApp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/webapi/doc/createApp.png
--------------------------------------------------------------------------------
/webapi/doc/ip.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/webapi/doc/ip.png
--------------------------------------------------------------------------------
/webapi/doc/skill.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/webapi/doc/skill.png
--------------------------------------------------------------------------------
/webapi/doc/webapi接口接入文档.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/webapi/doc/webapi接口接入文档.docx
--------------------------------------------------------------------------------
/webapi/nodejs/iat.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | var fs = require('fs');
3 | var http=require('http');
4 | const crypto = require('crypto');
5 | const hash = crypto.createHash('md5');
6 |
7 | var webiat = function(){
8 | //讯飞开放平台注册申请应用的应用ID(APPID)
9 | var xAppid = "xxxxxxxx";
10 | console.log('X-Appid:'+xAppid);
11 | var timestamp = Date.parse(new Date());
12 | var curTime = timestamp / 1000;
13 | console.log('X-CurTime:'+curTime);
14 | var xParam = {"auf": "16k", "aue": "raw", "scene": "main"}
15 | xParam = JSON.stringify(xParam);
16 | var xParamBase64 = new Buffer(xParam).toString('base64');
17 | console.log('X-Param:'+xParamBase64);
18 | //音频文件
19 | var fileData = fs.readFileSync('16k.pcm');
20 | var fileBase64 = new Buffer(fileData).toString('base64');
21 | var bodyData = "data="+fileBase64;
22 | //ApiKey创建应用时自动生成
23 | var apiKey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
24 | var token = apiKey + curTime+ xParamBase64 + bodyData;
25 | hash.update(token);
26 | var xCheckSum = hash.digest('hex');
27 | console.log('X-CheckSum:'+xCheckSum);
28 | var options={
29 | hostname:'api.xfyun.cn',
30 | port:80,
31 | path:'/v1/aiui/v1/iat',
32 | method:'POST',
33 | headers:{
34 | "X-Appid": xAppid,
35 | "X-CurTime": curTime,
36 | "X-Param":xParamBase64,
37 | "X-CheckSum":xCheckSum,
38 | 'Content-Type':'application/x-www-form-urlencoded; charset=UTF-8'
39 | }
40 | };
41 | var req = http.request(options, function(res) {
42 | res.setEncoding('utf-8');
43 | res.on('data',function(rersult){
44 | console.info('result body :'+rersult);
45 | });
46 | res.on('end',function(){
47 | console.log('No more data in response.');
48 | });
49 | });
50 | req.on('error',function(err){
51 | console.error(err);
52 | });
53 | req.write(bodyData);
54 | req.end();
55 | };
56 |
57 | webiat();
58 |
59 | module.exports = webiat;
--------------------------------------------------------------------------------
/webapi/python/iat.py:
--------------------------------------------------------------------------------
1 | # -*- coding:utf-8 -*-
2 | import base64
3 | import sys
4 | import time
5 | import json
6 | import hashlib
7 | from urllib import request,parse
8 |
9 | def webiat():
10 | print("python version : .{}".format(sys.version))
11 | requrl = "https://api.xfyun.cn/v1/aiui/v1/iat"
12 | print('requrl:{}'.format(requrl))
13 | #讯飞开放平台注册申请应用的应用ID(APPID)
14 | x_appid = "xxxxxxxx";
15 | print('X-Appid:{}'.format(x_appid))
16 | cur_time = int(time.time())
17 | print('X-CurTime:{}'.format(cur_time))
18 | x_param = {"auf":"16k","aue":"raw","scene":"main"}
19 | x_param = json.dumps(x_param)
20 | xparam_base64 = base64.b64encode(x_param.encode(encoding="utf-8")).decode().strip('\n')
21 | print('X-Param:{}'.format(xparam_base64))
22 | #音频文件
23 | file_data = open('16k.pcm', 'rb')
24 | file_base64 = base64.b64encode(file_data.read())
25 | file_data.close()
26 | body_data = "data="+file_base64.decode("utf-8")
27 | #ApiKey创建应用时自动生成
28 | api_key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
29 | token = api_key + str(cur_time)+ xparam_base64 + body_data
30 | m = hashlib.md5()
31 | m.update(token.encode(encoding='utf-8'))
32 | x_check_sum = m.hexdigest()
33 | print('X-CheckSum:{}'.format(x_check_sum))
34 | headers = {"X-Appid": x_appid,"X-CurTime": cur_time,"X-Param":xparam_base64,"X-CheckSum":x_check_sum,"Content-Type":"application/x-www-form-urlencoded"}
35 | print("headers : {}".format(headers))
36 | req = request.Request(requrl, data=body_data.encode('utf-8'), headers=headers, method="POST")
37 | with request.urlopen(req) as f:
38 | body = f.read().decode('utf-8')
39 | print("result body : {}".format(body))
40 |
41 | webiat()
--------------------------------------------------------------------------------
/webapi_v2/c-sharp/WebaiuiDemo.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/webapi_v2/c-sharp/WebaiuiDemo.cs
--------------------------------------------------------------------------------
/webapi_v2/doc/接口概述.md:
--------------------------------------------------------------------------------
1 | - [API说明](##1)
2 | - [授权认证](##2)
3 | - [IP白名单](##3)
4 |
5 |
6 | ## API说明
7 | 1. 授权认证,调用接口需要将 Appid,CurTime, Param 和 CheckSum 信息放在 HTTP 请求头中;
8 | 2. 接口统一为 UTF-8 编码;
9 | 3. 接口支持 http 和 https;
10 | 4. 请求方式为POST。
11 |
12 |
13 | ## 授权认证
14 | 在调用所有业务接口时,都需要在 Http Request Header 中配置以下参数用于授权认证:
15 |
16 | |参数|格式|说明|必须|
17 | |:-------|:---------|:--------|:---------|
18 | |X-Appid|string|讯飞开放平台注册申请应用的应用ID(appid)|是|
19 | |X-CurTime|string|当前UTC时间戳,从1970年1月1日0点0 分0 秒开始到现在的秒数|是|
20 | |X-Param|string|相关参数JSON串经Base64编码后的字符串,见各接口详细说明|是|
21 | |X-CheckSum|string|令牌,计算方法:MD5(apiKey + curTime + param),三个值拼接的字符串,进行MD5哈希计算(32位小写),其中apiKey由讯飞提供,调用方管理。 |是|
22 |
23 | *注:*
24 | * apiKey:接口密钥,由讯飞开放平台提供,调用方注意保管,如泄露,可联系讯飞技术人员重置;
25 | * checkSum 有效期:出于安全性考虑,每个 checkSum 的有效期为 5 分钟(用 curTime 计算),同时 curTime 要与标准时间同步,否则,时间相差太大,服务端会直接认为 curTime 无效;
26 | * BASE64 编码采用 MIME 格式,字符包括大小写字母各26个,加上10个数字,和加号 + ,斜杠 / ,一共64个字符。
27 |
28 | *checkSum *生成示例:
29 | ~~~
30 | String apiKey="abcd1234";
31 | String curTime="1502607694";
32 | String param="eyAiYXVmIjogImF1ZGlvL0wxNjtyYXR...";
33 | String checkSum=MD5(apiKey+curTime+param);
34 | ~~~
35 |
36 |
37 | ## IP白名单
38 | 在调用所有业务接口时,授权认证通过后,检查调用方 ip 是否在讯飞开放平台配置的 ip白名单 中。存在通过,否则拒绝提供服务。
39 | *注:*
40 | * IP白名单 可联系讯飞技术人员设置;
41 | * 拒绝提供服务返回值:
42 |
43 | ~~~
44 | {
45 | "code":"10105",
46 | "desc":"illegal access|illegal client_ip",
47 | "data":"",
48 | "sid":"xxxxxx"
49 | }
50 | ~~~
--------------------------------------------------------------------------------
/webapi_v2/doc/简介.md:
--------------------------------------------------------------------------------
1 | 本文档是集成科大讯飞 REST API 的用户指南,介绍各 能力接口的基本使用。在集成过程有疑问,可登录语音云开发者论坛,查找答案或与其他开发者交流:[http://bbs.xfyun.cn ](http://bbs.xfyun.cn )。
2 |
3 | 注意:
4 | 此文章的代码,仅为用于示例调用和参数设置的代码片段,很可能有参数被引用,却未曾声明等情况,请开发者不必过于考究其中的细节。
--------------------------------------------------------------------------------
/webapi_v2/doc/错误码.md:
--------------------------------------------------------------------------------
1 | | 错误码 |描述|说明|处理方式|
2 | |:-------------|:-------------|:-------------|:-------------|
3 | |0|success|成功||
4 | |10105|illegal access|没有权限|检查apiKey,ip,checkSum等授权参数是否正确|
5 | |10106|invalid parameter|无效参数或参数值为空|上传必要的参数, 检查参数格式以及编码|
6 | |10107|illegal parameter|非法参数值|检查参数值是否超过范围或不符合要求|
7 | |10109|illegal data length|数据长度非法|检查上传数据长度是否超过限制|
8 | |10110|no license|无授权许可|提供请求的 appid、 auth_id 向服务商反馈|
9 | |10114|time out|超时|检测网络连接或联系服务商|
10 | |10700|engine error|引擎错误|提供接口返回值,向服务商反馈|
11 | |11004|server up error|服务请求上线错误|提供接口返回值,向服务商反馈|
12 | |10202|websocket connect error|套接字连接异常|提供接口返回值,向服务商反馈|
13 | |10204|websocket write error|网络数据包发送异常|提供接口返回值,向服务商反馈|
14 | |10205|websocket read error|网络数据包接收异常|提供接口返回值,向服务商反馈|
15 | |11201|appid authorize number not enough|每秒交互次数超过上限|确认接口每秒交互次数是否超过限制(默认为20)|
--------------------------------------------------------------------------------
/webapi_v2/java/commons-codec-1.6.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/webapi_v2/java/commons-codec-1.6.jar
--------------------------------------------------------------------------------
/webapi_v2/nodejs/WebaiuiDemo.js:
--------------------------------------------------------------------------------
1 | const crypto = require('crypto');
2 | const fs = require('fs');
3 | const path = require('path');
4 |
5 | var http=require('http');
6 | var querystring=require('querystring');
7 |
8 | var APPID = "";
9 | var API_KEY = "";
10 | var AUTH_ID = "2894c985bf8b1111c6728db79d3479ae";
11 | var AUE = "raw";
12 | var CLIENT_IP = "127.0.0.1";
13 | var SAMPLE_RATE = "16000";
14 | var DATA_TYPE = "audio";
15 | var SCENE = "main";
16 | var LAT = "39.938838";
17 | var LNG = "116.368624";
18 | var RESULT_LEVEL = "complete";
19 | var FILE_PATH = ""
20 | // 个性化参数,需转义
21 | var PERS_PARAM = "{\\\"auth_id\\\":\\\"2894c985bf8b1111c6728db79d3479ae\\\"}";
22 |
23 | var X_CurTime = Math.floor(Date.now()/1000);
24 | var param = "{\"result_level\":\""+RESULT_LEVEL+"\",\"aue\":\""+AUE+"\",\"scene\":\""+SCENE+"\",\"auth_id\":\""+AUTH_ID+"\",\"data_type\":\""+DATA_TYPE+"\",\"sample_rate\":\""+SAMPLE_RATE+"\",\"lat\":\""+LAT+"\",\"lng\":\""+LNG+"\"}";
25 | //使用个性化参数时参数格式如下:
26 | // var param = "{\"result_level\":\""+RESULT_LEVEL+"\",\"aue\":\""+AUE+"\",\"scene\":\""+SCENE+"\",\"auth_id\":\""+AUTH_ID+"\",\"data_type\":\""+DATA_TYPE+"\",\"sample_rate\":\""+SAMPLE_RATE+"\",\"lat\":\""+LAT+"\",\"lng\":\""+LNG+"\",\"pers_param\":\""+PERS_PARAM+"\"}";
27 | var X_Param = new Buffer(param).toString('base64');
28 | var X_CheckSum = md5(API_KEY+X_CurTime+X_Param);
29 |
30 | var options={
31 | hostname:'openapi.xfyun.cn',
32 | port:80,
33 | path:'/v2/aiui',
34 | method:'POST',
35 | headers:{
36 | 'X-Param': X_Param,
37 | 'X-CurTime': X_CurTime,
38 | 'X-CheckSum': X_CheckSum,
39 | 'X-Appid': APPID
40 | }
41 | }
42 |
43 | var data = fs.readFileSync(path.resolve(FILE_PATH));
44 |
45 | var req=http.request(options, function(res) {
46 | console.log('Status:',res.statusCode);
47 | res.setEncoding('utf-8');
48 | res.on('data',function(chun){
49 | console.log('response:\r\n');
50 | console.info(chun);
51 | });
52 | res.on('end',function(){
53 | console.log('end');
54 | });
55 | });
56 |
57 | req.on('error',function(err){
58 | console.error(err);
59 | });
60 |
61 | req.write(data);
62 | req.end();
63 |
64 | function md5 (text) {
65 | return crypto.createHash('md5').update(text).digest('hex');
66 | };
--------------------------------------------------------------------------------
/webapi_v2/php/WebaiuiDemo.php:
--------------------------------------------------------------------------------
1 | $RESULT_LEVEL,
21 | "aue"=>$AUE,
22 | "scene"=>$SCENE,
23 | "auth_id"=>$AUTH_ID,
24 | "data_type"=>$DATA_TYPE,
25 | "sample_rate"=>$SAMPLE_RATE,
26 | "lat"=>$LAT,
27 | "lng"=>$LNG,
28 | //如需使用个性化参数:
29 | //"pers_param"=>$PERS_PARAM,
30 | );
31 |
32 | $curTime = time();
33 | $paramBase64 = base64_encode(json_encode($Param));
34 | $checkSum = md5($API_KEY.$curTime.$paramBase64);
35 |
36 | $headers = array();
37 | $headers[] = 'X-CurTime:'.$curTime;
38 | $headers[] = 'X-Param:'.$paramBase64;
39 | $headers[] = 'X-CheckSum:'.$checkSum;
40 | $headers[] = 'X-Appid:'.$APPID;
41 |
42 | $fp = fopen($FILE_PATH, "rb");
43 | $dataArray = fread($fp,filesize($FILE_PATH));
44 |
45 | echo $this->https_request($URL, $dataArray, $headers);
46 | echo "\n";
47 | }
48 |
49 | function https_request($url, $post_data, $headers) {
50 | $options = array(
51 | 'http' => array(
52 | 'method' => 'POST',
53 | 'header' => $headers,
54 | 'content' => $post_data,
55 | 'timeout' => 10
56 | )
57 | );
58 | $context = stream_context_create($options);
59 | $result = file_get_contents($url, false, $context);
60 |
61 | echo $result;
62 | }
63 | }
64 | $demo = new Demo();
65 | $demo->testWebaiui();
66 | ?>
--------------------------------------------------------------------------------
/webapi_v2/python/WebaiuiDemo.py:
--------------------------------------------------------------------------------
1 | #-*- coding: utf-8 -*-
2 | import requests
3 | import time
4 | import hashlib
5 | import base64
6 |
7 | URL = "http://openapi.xfyun.cn/v2/aiui"
8 | APPID = ""
9 | API_KEY = ""
10 | AUE = "raw"
11 | AUTH_ID = "2894c985bf8b1111c6728db79d3479ae"
12 | DATA_TYPE = "audio"
13 | SAMPLE_RATE = "16000"
14 | SCENE = "main"
15 | RESULT_LEVEL = "complete"
16 | LAT = "39.938838"
17 | LNG = "116.368624"
18 | #个性化参数,需转义
19 | PERS_PARAM = "{\\\"auth_id\\\":\\\"2894c985bf8b1111c6728db79d3479ae\\\"}"
20 | FILE_PATH = ""
21 |
22 |
23 | def buildHeader():
24 | curTime = str(int(time.time()))
25 | param = "{\"result_level\":\""+RESULT_LEVEL+"\",\"auth_id\":\""+AUTH_ID+"\",\"data_type\":\""+DATA_TYPE+"\",\"sample_rate\":\""+SAMPLE_RATE+"\",\"scene\":\""+SCENE+"\",\"lat\":\""+LAT+"\",\"lng\":\""+LNG+"\"}"
26 | #使用个性化参数时参数格式如下:
27 | #param = "{\"result_level\":\""+RESULT_LEVEL+"\",\"auth_id\":\""+AUTH_ID+"\",\"data_type\":\""+DATA_TYPE+"\",\"sample_rate\":\""+SAMPLE_RATE+"\",\"scene\":\""+SCENE+"\",\"lat\":\""+LAT+"\",\"lng\":\""+LNG+"\",\"pers_param\":\""+PERS_PARAM+"\"}"
28 | paramBase64 = base64.b64encode(param)
29 |
30 | m2 = hashlib.md5()
31 | m2.update(API_KEY + curTime + paramBase64)
32 | checkSum = m2.hexdigest()
33 |
34 | header = {
35 | 'X-CurTime': curTime,
36 | 'X-Param': paramBase64,
37 | 'X-Appid': APPID,
38 | 'X-CheckSum': checkSum,
39 | }
40 | return header
41 |
42 | def readFile(filePath):
43 | binfile = open(filePath, 'rb')
44 | data = binfile.read()
45 | return data
46 |
47 | r = requests.post(URL, headers=buildHeader(), data=readFile(FILE_PATH))
48 | print(r.content)
--------------------------------------------------------------------------------
/webapi_v2/resource/bj_weather.wav:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/webapi_v2/resource/bj_weather.wav
--------------------------------------------------------------------------------
/webapi_v2_entity/doc/动态实体webapi.md:
--------------------------------------------------------------------------------
1 | # API说明
2 |
3 | * 授权认证,调用接口需要将nameSpace,nonce,curtime和checkSum信息放在HTTP请求头中。
4 | * 所有接口统一为UTF-8编码。
5 | * 所有接口支持http和https。
6 |
7 | # 授权认证
8 |
9 | 在调用所有业务接口时,都需要在Http Request Header中加入以下参数作为授权验证
10 |
11 | |参数名|说明|是否必须|
12 | | ------|----------------------|--------|
13 | | X-NameSpace | aiui开放平台个人中心的命名空间 |是|
14 | | X-Nonce |随机数(最大长度128个字符)|是|
15 | | X-CurTime |当前UTC时间戳,从1970年1月1日0点0 分0 秒开始到现在的秒数(String)|是|
16 | | X-CheckSum |MD5(accountKey + Nonce + CurTime),三个参数拼接的字符串,进行MD5哈希计算|是|
17 |
18 | 注:
19 |
20 | * CheckSum有效期:出于安全性考虑,每个CheckSum的有效期为5分钟(用curTime计算),同时CurTime要与标准时间同步,否则,时间相差太大,服务端会直接认为CurTime无效。
21 |
22 | * checkSum生成示例,例如:
23 |
24 | accountKey是abcd1234, Nonce是12, CurTime是1502607694。那么CheckSum为MD5(abcd1234121502607694)
25 | 最终MD5为32位小写 bf5aa1f53bd173cf7413bf370ad4bddc
26 |
27 | # IP 白名单
28 |
29 | IP 白名单具备打开和关闭两种状态。
30 |
31 | * 当 IP 白名单打开时,用户在调用所有业务接口时,在授权认证通过后,检查调用方ip是否在aiui开放平台配置的ip白名单中。若在,则向用户提供服务,否则拒绝提供服务。
32 |
33 | * 当 IP 白名单关闭时,任意终端均可访问 AIUI 服务器,开发者需要自行保证 nameSpace 和 key 值安全。
34 |
35 | 注:拒绝提供服务返回值:{"code":"20004","desc":"ip非法","data":null,"sid":"rwabb52e660@dx6c9b0e56f81d3ef000"}
36 |
37 | # 通用请求地址
38 |
39 | base_url:openapi.xfyun.cn
40 |
41 | # AIUI接口
42 |
43 | 通用返回参数
44 |
45 | |参数名|说明|是否必须|
46 | | ------|----------------------|--------|
47 | |code |结果码 |是|
48 | |data |返回结果 |是|
49 | |desc |描述 |是|
50 | |sid |本次webapi服务唯一标识 |是|
51 |
52 | ## 动态实体
53 | ### 上传资源
54 |
55 | * 接口描述
56 |
57 | 本接口提供动态实体上传资源功能,用于动态更新实体资源。
58 |
59 | * 接口地址
60 |
61 | POST /v2/aiui/entity/upload-resource HTTP/1.1
62 |
63 | Content-Type:application/x-www-form-urlencoded; charset=utf-8
64 |
65 | * 参数说明
66 |
67 | |参数|类型|必须|说明|示例
|
68 | | ------|-------|-------|--------|--------|
69 | |appid|string|是|应用id|5adde3cf|
70 | |res_name|String|是|资源名,XXX为用户的命名空间|XXX.music|
71 | |pers_param|String|是|个性化参数(json)|{"appid":"xxxxxx"}|
72 | |data|String|是|Base64编码的资源|示例1|
73 |
74 | 其中,pers_param为个性化参数。示例如下:
75 |
76 | |维度|示例|说明|
77 | | ------|-------|-------|
78 | |应用级|{"appid":"xxxxxx"}||
79 | |用户级|{"auth_id":"d3b6d50a9f8194b623b5e2d4e298c9d6"}|auth_id为用户唯一ID(32位字符串,包括英文小写字母与数字,开发者需保证该值与终端用户一一对应)|
80 | |自定义级|{"xxxxxx":"xxxxxx"}||
81 |
82 | data为web页面定义的主子段、从字段给的json格式对应的base64。例如,主子段为song、从字段singer,上传资源的格式为:
83 |
84 | {"song":"给我一首歌的时间","singer":"周杰伦"}
85 | {"song":"忘情水","singer":"刘德华"}
86 | {"song":"暗香","singer":"刘德华"}
87 | {"song":"逆光","singer":"梁静茹"}
88 |
89 | 注:每条数据之间用换行符隔开。
90 |
91 | Base64编码为
92 |
93 | 示例1:
94 |
95 | eyJzb25nIjoi57uZ5oiR5LiA6aaW5q2M55qE5pe26Ze0Iiwic2luZ2VyIjoi5ZGo5p2w5LymIn0NCnsic29uZyI6IuW/mOaDheawtCIsInNpbmdlciI6IuWImOW+t+WNjiJ9DQp7InNvbmciOiLmmpfpppkiLCJzaW5nZXIiOiLliJjlvrfljY4ifQ0KeyJzb25nIjoi6YCG5YWJIiwic2luZ2VyIjoi5qKB6Z2Z6Iy5In0=
96 |
97 | * 返回说明
98 |
99 | |参数 |类型 |必须 |说明 |示例|
100 | | ------|-------|-------|--------|--------|
101 | |sid |String |是 |本次上传sid,可用于查看上传资源是否成功|psn003478f3@ch00070e3a78e06f2601|
102 | |csid |String |是 |本次服务唯一标识|rwa84b7a73b@ch372d0e3a78e0116200|
103 |
104 | ### 查看上传资源是否成功
105 |
106 | * 接口描述
107 |
108 | 本接口提供检查动态实体上传资源是否成功。
109 |
110 | 注:上传资源数据后至少间隔3秒后再进行查看上传资源是否成功
111 |
112 | * 接口地址
113 |
114 | POST /v2/aiui/entity/check-resource HTTP/1.1
115 |
116 | Content-Type:application/x-www-form-urlencoded; charset=utf-8
117 |
118 | * 参数说明
119 |
120 | |参数|类型|必须|说明|示例|
121 | | ------|-------|-------|--------|--------|
122 | |sid|string|是|sid|psn开头的sid|
123 |
124 | * 返回说明
125 |
126 | |参数 |类型 |必须 |说明 |
127 | | ------|-------|-------|--------|
128 | |sid |String |是 |上传sid|
129 | |csid |String |是 |上传sid|
130 | |reply |String |是 |查看上传资源是否成功描述|
131 | |error |int |是 |查看上传资源是否成功错误码|
--------------------------------------------------------------------------------
/webapi_v2_entity/python/WebEntityDemo.py:
--------------------------------------------------------------------------------
1 | # -*- coding:utf-8 -*-
2 | import base64
3 | import sys
4 | import time
5 | import json
6 | import hashlib
7 | import urllib.parse
8 | from urllib import request,parse
9 |
10 | UPLOAD_URL = "https://openapi.xfyun.cn/v2/aiui/entity/upload-resource";
11 | CHECK_URL = "https://openapi.xfyun.cn/v2/aiui/entity/check-resource";
12 | X_NONCE = "12";
13 | APPID = "";
14 | X_NAMESPACE = "";
15 | ACCOUNTKEY = "";
16 |
17 | def buildHeader():
18 | curTime = str(int(time.time()))
19 | m = hashlib.md5()
20 | m.update((ACCOUNTKEY + X_NONCE + curTime).encode(encoding='utf-8'))
21 | checkSum = m.hexdigest()
22 |
23 | header = {
24 | 'X-NameSpace': X_NAMESPACE,
25 | 'X-Nonce': X_NONCE,
26 | 'X-CurTime': curTime,
27 | 'X-CheckSum': checkSum,
28 | }
29 | return header
30 |
31 | def buildUploadBody():
32 | #每条数据之间用换行符隔开
33 | param = "{\"name\":\"张三\",\"phoneNumber\":\"13888888888\"}" + "\r\n" + "{\"name\":\"李四\",\"phoneNumber\":\"13666666666\"}"
34 | paramBase64 = base64.b64encode(param.encode(encoding="utf-8")).decode().strip('\n')
35 | body = {
36 | 'appid': APPID,
37 | 'res_name': 'IFLYTEK.telephone_contact',
38 | 'pers_param': '{\"auth_id\":\"d3b6d50a9f8194b623b5e2d4e298c9d6\"}',
39 | 'data': paramBase64,
40 | }
41 | return body
42 |
43 | def buildCheckBody(sid):
44 | body = {
45 | 'sid': sid
46 | }
47 | return body
48 |
49 | def webEntityDemo():
50 | body_data = buildUploadBody()
51 | body_data = urllib.parse.urlencode(body_data).encode('utf-8')
52 | req = request.Request(UPLOAD_URL, data=body_data, headers=buildHeader(), method="POST")
53 | f = request.urlopen(req)
54 | result = f.read().decode('utf-8')
55 | print("result body : {}".format(result))
56 | upload_jo = json.loads(result)
57 | code = upload_jo['code']
58 | if(code == '00000'):
59 | #上传资源数据后至少间隔3秒后再进行查看上传资源是否成功
60 | time.sleep(3)
61 | sid = upload_jo['data']['sid']
62 | check_body_data = buildCheckBody(sid)
63 | check_body_data = urllib.parse.urlencode(check_body_data).encode('utf-8')
64 | check_req = request.Request(CHECK_URL, data=check_body_data, headers=buildHeader(), method="POST")
65 | cf = request.urlopen(check_req)
66 | check_result = cf.read().decode('utf-8')
67 | print("check result body : {}".format(check_result))
68 |
69 | print("python version : .{}".format(sys.version))
70 | webEntityDemo()
--------------------------------------------------------------------------------
/websocket/c-sharp/aiui_ws_csharp_demo.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.28307.1267
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "aiui_ws_csharp_demo", "aiui_ws_csharp_demo\aiui_ws_csharp_demo.csproj", "{E12F36D1-D9CE-433E-8A08-A5AE6AAAC11C}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {E12F36D1-D9CE-433E-8A08-A5AE6AAAC11C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {E12F36D1-D9CE-433E-8A08-A5AE6AAAC11C}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {E12F36D1-D9CE-433E-8A08-A5AE6AAAC11C}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {E12F36D1-D9CE-433E-8A08-A5AE6AAAC11C}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {80F352A9-D501-4A5E-B83A-ECA7434442EF}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/websocket/c-sharp/aiui_ws_csharp_demo/.gitignore:
--------------------------------------------------------------------------------
1 | bin
2 | obj
--------------------------------------------------------------------------------
/websocket/c-sharp/aiui_ws_csharp_demo/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("aiui_ws_csharp_demo")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("aiui_ws_csharp_demo")]
13 | [assembly: AssemblyCopyright("Copyright © 2020")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("e12f36d1-d9ce-433e-8a08-a5ae6aaac11c")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/websocket/c-sharp/aiui_ws_csharp_demo/aiui_ws_csharp_demo.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {E12F36D1-D9CE-433E-8A08-A5AE6AAAC11C}
8 | Exe
9 | ConsoleApp1
10 | ConsoleApp1
11 | v4.0
12 | 512
13 | true
14 |
15 |
16 | AnyCPU
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | AnyCPU
27 | pdbonly
28 | true
29 | bin\Release\
30 | TRACE
31 | prompt
32 | 4
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 | ..\packages\WebSocketSharp-netstandard.1.0.1\lib\net35\websocket-sharp.dll
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/websocket/c-sharp/aiui_ws_csharp_demo/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/websocket/c-sharp/aiui_ws_csharp_demo/test.pcm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/websocket/c-sharp/aiui_ws_csharp_demo/test.pcm
--------------------------------------------------------------------------------
/websocket/c-sharp/packages/WebSocketSharp-netstandard.1.0.1/.signature.p7s:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/websocket/c-sharp/packages/WebSocketSharp-netstandard.1.0.1/.signature.p7s
--------------------------------------------------------------------------------
/websocket/c-sharp/packages/WebSocketSharp-netstandard.1.0.1/WebSocketSharp-netstandard.1.0.1.nupkg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/websocket/c-sharp/packages/WebSocketSharp-netstandard.1.0.1/WebSocketSharp-netstandard.1.0.1.nupkg
--------------------------------------------------------------------------------
/websocket/c-sharp/packages/WebSocketSharp-netstandard.1.0.1/lib/net35/websocket-sharp.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/websocket/c-sharp/packages/WebSocketSharp-netstandard.1.0.1/lib/net35/websocket-sharp.dll
--------------------------------------------------------------------------------
/websocket/c-sharp/packages/WebSocketSharp-netstandard.1.0.1/lib/net45/websocket-sharp.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/websocket/c-sharp/packages/WebSocketSharp-netstandard.1.0.1/lib/net45/websocket-sharp.dll
--------------------------------------------------------------------------------
/websocket/c-sharp/packages/WebSocketSharp-netstandard.1.0.1/lib/netstandard2.0/websocket-sharp.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/websocket/c-sharp/packages/WebSocketSharp-netstandard.1.0.1/lib/netstandard2.0/websocket-sharp.dll
--------------------------------------------------------------------------------
/websocket/c/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 | !src
4 | !CMakeLists.txt
--------------------------------------------------------------------------------
/websocket/c/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8)
2 | project(aiui_demo)
3 |
4 | set(CMAKE_C_FLAGS "-w ${CMAKE_C_FLAGS} -O0 -g3 -DCJSON_HIDE_SYMBOLS")
5 |
6 | include_directories(src)
7 | link_libraries(-lpthread -lm -ldl)
8 |
9 | FILE(GLOB_RECURSE SRC_LIST
10 | "${CMAKE_CURRENT_LIST_DIR}/src/*.c"
11 | "${CMAKE_CURRENT_LIST_DIR}/src/*.h")
12 |
13 | macro(source_group_by_dir abs_cur_dir source_files)
14 | if (MSVC)
15 | set(sgbd_cur_dir ${${abs_cur_dir}})
16 | foreach(sgbd_file ${${source_files}})
17 | string(REGEX REPLACE ${sgbd_cur_dir}/\(.*\) \\1 sgbd_fpath ${sgbd_file})
18 | string(REGEX REPLACE "\(.*\)/.*" \\1 sgbd_group_name ${sgbd_fpath})
19 | string(COMPARE EQUAL ${sgbd_fpath} ${sgbd_group_name} sgbd_nogroup)
20 | string(REPLACE "/" "\\" sgbd_group_name ${sgbd_group_name})
21 | if(sgbd_nogroup)
22 | set(sgbd_group_name "\\")
23 | endif(sgbd_nogroup)
24 | source_group(${sgbd_group_name} FILES ${sgbd_file})
25 | endforeach(sgbd_file)
26 | endif (MSVC)
27 | endmacro(source_group_by_dir)
28 |
29 | source_group_by_dir(CMAKE_CURRENT_LIST_DIR SRC_LIST)
30 |
31 | add_definitions(-DSINGLE_MAIN)
32 |
33 | SET(EXECUTABLE_OUTPUT_PATH ../bin)
34 | set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
35 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
36 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
37 |
38 | add_executable(aiui_demo ${SRC_LIST})
39 |
--------------------------------------------------------------------------------
/websocket/c/README.txt:
--------------------------------------------------------------------------------
1 | 1. 仅适配 Linux 平台
2 | 2. 确保平台已开通语义功能且关闭白名单
3 | 3. 修改代码中的 appid 和 key
--------------------------------------------------------------------------------
/websocket/c/bin/test.pcm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/websocket/c/bin/test.pcm
--------------------------------------------------------------------------------
/websocket/c/src/aiui/aiui_base64.h:
--------------------------------------------------------------------------------
1 | #ifndef BASE64__H
2 | #define BASE64__H
3 |
4 | /**
5 | * encode an array of bytes using Base64 (RFC 3548)
6 | *
7 | * @param source the source buffer
8 | * @param sourcelen the length of the source buffer
9 | * @param target the target buffer
10 | * @param targetlen the length of the target buffer
11 | * @return 1 on success, 0 otherwise
12 | */
13 | int aiui_base64_encode(unsigned char *source, size_t sourcelen, char *target, size_t targetlen);
14 |
15 | /**
16 | * decode base64 encoded data
17 | *
18 | * @param source the encoded data (zero terminated)
19 | * @param target pointer to the target buffer
20 | * @param targetlen length of the target buffer
21 | * @return length of converted data on success, -1 otherwise
22 | */
23 | size_t aiui_base64_decode(char *source, unsigned char *target, size_t targetlen);
24 |
25 | #endif
--------------------------------------------------------------------------------
/websocket/c/src/aiui/aiui_platform_util.h:
--------------------------------------------------------------------------------
1 | /**
2 | * \file platform_util.h
3 | *
4 | * \brief Common and shared functions used by multiple modules in the Mbed TLS
5 | * library.
6 | */
7 | /*
8 | * Copyright (C) 2018, Arm Limited, All Rights Reserved
9 | * SPDX-License-Identifier: Apache-2.0
10 | *
11 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
12 | * not use this file except in compliance with the License.
13 | * You may obtain a copy of the License at
14 | *
15 | * http://www.apache.org/licenses/LICENSE-2.0
16 | *
17 | * Unless required by applicable law or agreed to in writing, software
18 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
19 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 | * See the License for the specific language governing permissions and
21 | * limitations under the License.
22 | *
23 | * This file is part of Mbed TLS (https://tls.mbed.org)
24 | */
25 | #ifndef AIUI_MBEDTLS_PLATFORM_UTIL_H
26 | #define AIUI_MBEDTLS_PLATFORM_UTIL_H
27 |
28 | #include
29 |
30 | #ifdef __cplusplus
31 | extern "C" {
32 | #endif
33 |
34 | /**
35 | * \brief Securely zeroize a buffer
36 | *
37 | * The function is meant to wipe the data contained in a buffer so
38 | * that it can no longer be recovered even if the program memory
39 | * is later compromised. Call this function on sensitive data
40 | * stored on the stack before returning from a function, and on
41 | * sensitive data stored on the heap before freeing the heap
42 | * object.
43 | *
44 | * It is extremely difficult to guarantee that calls to
45 | * mbedtls_platform_zeroize() are not removed by aggressive
46 | * compiler optimizations in a portable way. For this reason, Mbed
47 | * TLS provides the configuration option
48 | * MBEDTLS_PLATFORM_ZEROIZE_ALT, which allows users to configure
49 | * mbedtls_platform_zeroize() to use a suitable implementation for
50 | * their platform and needs
51 | *
52 | * \param buf Buffer to be zeroized
53 | * \param len Length of the buffer in bytes
54 | *
55 | */
56 | void mbedtls_platform_zeroize( void *buf, size_t len );
57 |
58 | #ifdef __cplusplus
59 | }
60 | #endif
61 |
62 | #endif /* AIUI_MBEDTLS_PLATFORM_UTIL_H */
63 |
--------------------------------------------------------------------------------
/websocket/c/src/aiui_extern.c:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | aiui_init_pthread_attr(pthread_attr_t *attr, int size)
4 | {
5 | pthread_attr_init(attr);
6 | pthread_attr_setstacksize(attr, size);
7 | }
8 |
9 | void aiui_destroy_pthread_attr(pthread_attr_t *attr)
10 | {
11 | pthread_attr_destroy(attr);
12 | }
--------------------------------------------------------------------------------
/websocket/c/src/aiui_platform_util.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Common and shared functions used by multiple modules in the Mbed TLS
3 | * library.
4 | *
5 | * Copyright (C) 2018, Arm Limited, All Rights Reserved
6 | * SPDX-License-Identifier: Apache-2.0
7 | *
8 | * Licensed under the Apache License, Version 2.0 (the "License"); you may
9 | * not use this file except in compliance with the License.
10 | * You may obtain a copy of the License at
11 | *
12 | * http://www.apache.org/licenses/LICENSE-2.0
13 | *
14 | * Unless required by applicable law or agreed to in writing, software
15 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 | * See the License for the specific language governing permissions and
18 | * limitations under the License.
19 | *
20 | * This file is part of Mbed TLS (https://tls.mbed.org)
21 | */
22 |
23 | #if !defined(AIUI_MBEDTLS_CONFIG_FILE)
24 | #include "aiui/aiui_config.h"
25 | #else
26 | #include AIUI_MBEDTLS_CONFIG_FILE
27 | #endif
28 |
29 | #include "aiui/aiui_platform_util.h"
30 |
31 | #include
32 | #include
33 |
34 | #if !defined(AIUI_MBEDTLS_PLATFORM_ZEROIZE_ALT)
35 | /*
36 | * This implementation should never be optimized out by the compiler
37 | *
38 | * This implementation for mbedtls_platform_zeroize() was inspired from Colin
39 | * Percival's blog article at:
40 | *
41 | * http://www.daemonology.net/blog/2014-09-04-how-to-zero-a-buffer.html
42 | *
43 | * It uses a volatile function pointer to the standard memset(). Because the
44 | * pointer is volatile the compiler expects it to change at
45 | * any time and will not optimize out the call that could potentially perform
46 | * other operations on the input buffer instead of just setting it to 0.
47 | * Nevertheless, as pointed out by davidtgoldblatt on Hacker News
48 | * (refer to http://www.daemonology.net/blog/2014-09-05-erratum.html for
49 | * details), optimizations of the following form are still possible:
50 | *
51 | * if( memset_func != memset )
52 | * memset_func( buf, 0, len );
53 | *
54 | * Note that it is extremely difficult to guarantee that
55 | * mbedtls_platform_zeroize() will not be optimized out by aggressive compilers
56 | * in a portable way. For this reason, Mbed TLS also provides the configuration
57 | * option AIUI_MBEDTLS_PLATFORM_ZEROIZE_ALT, which allows users to configure
58 | * mbedtls_platform_zeroize() to use a suitable implementation for their
59 | * platform and needs.
60 | */
61 | static void * (* const volatile memset_func)( void *, int, size_t ) = memset;
62 |
63 | void mbedtls_platform_zeroize( void *buf, size_t len )
64 | {
65 | memset_func( buf, 0, len );
66 | }
67 | #endif /* AIUI_MBEDTLS_PLATFORM_ZEROIZE_ALT */
68 |
--------------------------------------------------------------------------------
/websocket/go/aiui_websocket_demo.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "fmt"
5 | "golang.org/x/net/websocket"
6 | "io/ioutil"
7 | "strconv"
8 | "time"
9 | "net/http"
10 | "encoding/base64"
11 | "crypto/md5"
12 | )
13 |
14 | // 数据结束发送标记
15 | const BREAK_FLAG = "--end--"
16 | // 每帧数据大小,单位:字节
17 | const SLICE_SIZE = 1280
18 | // AIUI websocket服务地址
19 | const WS_URL = "ws://wsapi.xfyun.cn/v1/aiui"
20 | const ORIGIN = "http://wsapi.xfyun.cn"
21 | // 应用ID,在AIUI开放平台创建并设置
22 | const APPID = ""
23 | // 接口密钥,在AIUI开放平台查看
24 | const API_KEY = ""
25 | // 发送的数据文件位置
26 | const FILE_PATH = "date.pcm"
27 |
28 | // 调用方式:运行 main(),控制台输出云端返回结果
29 | func main() {
30 | curtime := strconv.Itoa(int(time.Now().Unix()))
31 | param := `{"auth_id":"2894c985bf8b1111c6728db79d3479ae","data_type":"audio","aue":"raw","scene":"main","sample_rate":"16000"}`
32 | paramBase64 := base64.URLEncoding.EncodeToString([]byte(param))
33 | checksum := Md5Encode(API_KEY + curtime + paramBase64)
34 | // websocket 握手
35 | url := WS_URL + "?appid=" + APPID + "&checksum=" + checksum + "&curtime=" + curtime + "¶m=" + paramBase64
36 | config, _ := websocket.NewConfig(url, ORIGIN)
37 | config.Protocol = []string{"13"}
38 | header := make(map[string][] string)
39 | header["X-Real-Ip"] = []string{"114.116.69.134"}
40 | config.Header = http.Header(header)
41 | conn, err := websocket.DialConfig(config)
42 | if err != nil {
43 | fmt.Errorf("websocket dial err: %v", err)
44 | return
45 | }
46 | defer conn.Close()
47 |
48 | sendChan := make(chan int, 1)
49 | receiveChan := make(chan int, 1)
50 | defer close(sendChan)
51 | defer close(receiveChan)
52 | // 发送数据
53 | go send(conn, sendChan)
54 | // 接收数据
55 | go receive(conn, receiveChan)
56 | <-sendChan
57 | <-receiveChan
58 | return
59 | }
60 |
61 | // 发送数据
62 | func send(conn *websocket.Conn, sendChan chan int) {
63 | // 分帧发送音频数据
64 | audio1, _ := ioutil.ReadFile(FILE_PATH)
65 | if err := sendBySlice(conn, audio1); err != nil {
66 | fmt.Errorf("send data err: %v", err)
67 | sendChan <- 1
68 | return
69 | }
70 | // 发送结束符
71 | if err := websocket.Message.Send(conn, BREAK_FLAG); err != nil {
72 | fmt.Errorf("send break flag err: %v", err)
73 | sendChan <- 1
74 | return
75 | }
76 |
77 | sendChan <- 1
78 | return
79 | }
80 |
81 | // 分片发送数据
82 | func sendBySlice(conn *websocket.Conn, data []byte) (err error) {
83 | sliceNum := getSliceNum(len(data), SLICE_SIZE)
84 | for i := 0; i < sliceNum; i++ {
85 | var sliceData []byte
86 | if (i+1)*SLICE_SIZE < len(data) {
87 | sliceData = data[i*SLICE_SIZE : (i+1)*SLICE_SIZE]
88 | } else {
89 | sliceData = data[i*SLICE_SIZE:]
90 | }
91 | if err = websocket.Message.Send(conn, sliceData); err != nil {
92 | fmt.Errorf("send msg err: %v", err)
93 | return err
94 | }
95 | time.Sleep(time.Duration(40 * time.Millisecond))
96 | }
97 | return nil
98 | }
99 |
100 | // 接收结果
101 | func receive(conn *websocket.Conn, readChan chan int) {
102 | for {
103 | var msg string
104 | if err := websocket.Message.Receive(conn, &msg); err != nil {
105 | if err.Error() == "EOF" {
106 | fmt.Println("receive msg end")
107 | }else{
108 | fmt.Errorf("receive msg error: %v", msg)
109 | }
110 | readChan <- 1
111 | return
112 | }
113 | fmt.Println("receive msg: %v", msg)
114 | }
115 | readChan <- 1
116 | }
117 |
118 | // 计算数据帧数
119 | func getSliceNum(dataSize, sliceSize int) int {
120 | if dataSize%sliceSize == 0 {
121 | return dataSize / sliceSize
122 | } else {
123 | return dataSize/sliceSize + 1
124 | }
125 | }
126 |
127 | // 计算字符串MD5值
128 | func Md5Encode(str string) (strMd5 string) {
129 | strByte := []byte(str)
130 | strMd5Byte := md5.Sum(strByte)
131 | strMd5 = fmt.Sprintf("%x", strMd5Byte)
132 | return strMd5
133 | }
--------------------------------------------------------------------------------
/websocket/java/lib/Java-WebSocket-1.3.7.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/websocket/java/lib/Java-WebSocket-1.3.7.jar
--------------------------------------------------------------------------------
/websocket/java/lib/commons-codec-1.6.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/websocket/java/lib/commons-codec-1.6.jar
--------------------------------------------------------------------------------
/websocket/java/src/com/iflytek/aiui/websocketdemo/DraftWithOrigin.java:
--------------------------------------------------------------------------------
1 | package com.iflytek.aiui.websocketdemo;
2 |
3 | import org.java_websocket.drafts.Draft;
4 | import org.java_websocket.drafts.Draft_6455;
5 | import org.java_websocket.handshake.ClientHandshakeBuilder;
6 |
7 | public class DraftWithOrigin extends Draft_6455 {
8 |
9 | private String originUrl;
10 |
11 | public DraftWithOrigin(String originUrl) {
12 | this.originUrl = originUrl;
13 | }
14 |
15 | @Override
16 | public Draft copyInstance() {
17 | System.out.println(originUrl);
18 | return new DraftWithOrigin(originUrl);
19 | }
20 |
21 | @Override
22 | public ClientHandshakeBuilder postProcessHandshakeRequestAsClient( ClientHandshakeBuilder request) {
23 | super.postProcessHandshakeRequestAsClient(request);
24 | request.put("Origin", originUrl);
25 | return request;
26 | }
27 | }
--------------------------------------------------------------------------------
/websocket/js/aiui-websocket-demo.js:
--------------------------------------------------------------------------------
1 | var crypto = require('crypto');
2 | var WebSocketClient = require('websocket').client;
3 | var fs = require('fs');
4 |
5 | // AIUI websocket服务地址
6 | var BASE_URL = "wss://wsapi.xfyun.cn/v1/aiui";
7 | var ORIGIN = "http://wsapi.xfyun.cn";
8 | // 应用ID,在AIUI开放平台创建并设置
9 | var APPID = "xxxx";
10 | // 接口密钥,在AIUI开放平台查看
11 | var APIKEY = "xxxx";
12 | // 业务参数
13 | var PARAM = "{\"auth_id\":\"f8948af1d2d6547eaf09bc2f20ebfcc6\",\"data_type\":\"audio\",\"scene\":\"main_box\",\"sample_rate\":\"16000\",\"aue\":\"raw\",\"result_level\":\"plain\",\"context\":\"{\\\"sdk_support\\\":[\\\"tts\\\"]}\"}";
14 |
15 | // 计算握手参数
16 | function getHandshakeParams(){
17 | var paramBase64 = new Buffer(PARAM).toString('base64');
18 | var curtime = Math.floor(Date.now()/1000);
19 | var originStr = APIKEY + curtime + paramBase64;
20 | var checksum = crypto.createHash('md5').update(originStr).digest("hex");
21 | var handshakeParams = "?appid="+APPID+"&checksum="+checksum+"&curtime="+curtime+"¶m="+paramBase64;
22 | console.log(handshakeParams);
23 | return handshakeParams;
24 | }
25 |
26 | // 定义websocket client
27 | var client = new WebSocketClient();
28 |
29 | client.on('connectFailed', function(error) {
30 | console.log('Connect Error: ' + error.toString());
31 | });
32 |
33 | client.on('connect', function(connection) {
34 | console.log('WebSocket client connected');
35 | connection.on('error', function(error) {
36 | console.log("Connection Error: " + error.toString());
37 | });
38 | connection.on('close', function() {
39 | console.log('echo-protocol Connection Closed');
40 | });
41 | connection.on('message', function(message) {
42 | if (message.type === 'utf8') {
43 | console.log("Received: '" + message.utf8Data + "'");
44 | }
45 | });
46 |
47 | function sendMsg() {
48 | if (connection.connected) {
49 |
50 | let audioFile = fs.createReadStream('./weather.pcm');
51 | let idx = 0;
52 |
53 | audioFile.on("data", function(data) {
54 | console.log("发送音频块 ", idx++);
55 |
56 | connection.sendBytes(data);
57 | });
58 |
59 | audioFile.on("close", function() {
60 | connection.sendUTF("--end--");
61 | });
62 | }
63 | }
64 | // 发送数据
65 | sendMsg();
66 | });
67 |
68 | // 建立连接
69 | client.connect(BASE_URL+getHandshakeParams(), "", ORIGIN);
--------------------------------------------------------------------------------
/websocket/js/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "websocket": "^1.0.34"
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/websocket/js/weather.pcm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/websocket/js/weather.pcm
--------------------------------------------------------------------------------
/websocket/python/weather.pcm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/IflytekAIUI/DemoCode/414da5f64b7834cfc27e803b185be62fb7db1100/websocket/python/weather.pcm
--------------------------------------------------------------------------------