加入了聊天上下文
This commit is contained in:
parent
eb5395b9e8
commit
60fc4617ca
File diff suppressed because it is too large
Load Diff
|
|
@ -15334,12 +15334,12 @@
|
|||
1715152831 c:\users\lc\desktop\git\doubao_chat\include_lib\system\boot.h
|
||||
"asm/cpu.h"
|
||||
|
||||
1730443698 c:\users\lc\desktop\git\doubao_chat\apps\demo\demo_devkitboard\include\app_config.h
|
||||
1730947852 c:\users\lc\desktop\git\doubao_chat\apps\demo\demo_devkitboard\include\app_config.h
|
||||
"demo_config.h"
|
||||
"usb_std_class_def.h"
|
||||
"usb_common_def.h"
|
||||
|
||||
1730441630 c:\users\lc\desktop\git\doubao_chat\apps\demo\demo_devkitboard\include\demo_config.h
|
||||
1730970485 c:\users\lc\desktop\git\doubao_chat\apps\demo\demo_devkitboard\include\demo_config.h
|
||||
|
||||
1715152831 c:\users\lc\desktop\git\doubao_chat\apps\common\usb\usb_std_class_def.h
|
||||
|
||||
|
|
@ -15769,7 +15769,7 @@
|
|||
<stdlib.h>
|
||||
<string.h>
|
||||
|
||||
1729064203 c:\users\lc\desktop\git\doubao_chat\include_lib\net\lwip_2_1_3\lwip\app\apps\http_client.h
|
||||
1730889744 c:\users\lc\desktop\git\doubao_chat\include_lib\net\lwip_2_1_3\lwip\app\apps\http_client.h
|
||||
"lwip/opt.h"
|
||||
"lwip/ip_addr.h"
|
||||
"lwip/err.h"
|
||||
|
|
@ -27215,7 +27215,7 @@
|
|||
"app_config.h"
|
||||
"debug.h"
|
||||
|
||||
1730861380 source:c:\users\lc\desktop\git\doubao_chat\apps\wifi_daobao\aduio_playback.c
|
||||
1730945913 source:c:\users\lc\desktop\git\doubao_chat\apps\wifi_daobao\aduio_playback.c
|
||||
"server/audio_server.h"
|
||||
"server/server_core.h"
|
||||
"system/app_core.h"
|
||||
|
|
@ -27237,7 +27237,7 @@
|
|||
|
||||
1730271853 c:\users\lc\desktop\git\doubao_chat\apps\wifi_daobao\aduio_playback.h
|
||||
|
||||
1730864128 source:c:\users\lc\desktop\git\doubao_chat\apps\wifi_daobao\aduio_record_queue_new.c
|
||||
1730942905 source:c:\users\lc\desktop\git\doubao_chat\apps\wifi_daobao\aduio_record_queue_new.c
|
||||
"aduio_record.h"
|
||||
|
||||
1730864726 c:\users\lc\desktop\git\doubao_chat\apps\wifi_daobao\aduio_record.h
|
||||
|
|
@ -27256,7 +27256,7 @@
|
|||
"device/device.h"
|
||||
"asm/clock.h"
|
||||
|
||||
1730858113 source:c:\users\lc\desktop\git\doubao_chat\apps\wifi_daobao\chat_lwip_http_stream.c
|
||||
1730976213 source:c:\users\lc\desktop\git\doubao_chat\apps\wifi_daobao\chat_lwip_http_stream.c
|
||||
"system/includes.h"
|
||||
"wifi/wifi_connect.h"
|
||||
"apps/http_client.h"
|
||||
|
|
@ -27266,7 +27266,7 @@
|
|||
1715152831 c:\users\lc\desktop\git\doubao_chat\include_lib\net\cjson_common\cjson.h
|
||||
<stddef.h>
|
||||
|
||||
1730859979 source:c:\users\lc\desktop\git\doubao_chat\apps\wifi_daobao\stt_websocket_queue.c
|
||||
1730975332 source:c:\users\lc\desktop\git\doubao_chat\apps\wifi_daobao\stt_websocket_queue.c
|
||||
"web_socket/websocket_api.h"
|
||||
"wifi/wifi_connect.h"
|
||||
"system/includes.h"
|
||||
|
|
@ -27277,7 +27277,7 @@
|
|||
"mem_leak_test.h"
|
||||
"app_config.h"
|
||||
|
||||
1730861763 source:c:\users\lc\desktop\git\doubao_chat\apps\wifi_daobao\tts_websocket.c
|
||||
1730971097 source:c:\users\lc\desktop\git\doubao_chat\apps\wifi_daobao\tts_websocket.c
|
||||
"web_socket/websocket_api.h"
|
||||
"wifi/wifi_connect.h"
|
||||
"system/includes.h"
|
||||
|
|
@ -27581,3 +27581,46 @@
|
|||
"gpcnt.h"
|
||||
"gSensor_manage.h"
|
||||
|
||||
1729042150 source:c:\users\lc\desktop\git\doubao_chat\lib\net\lwip_2_1_3\apps\http\httpd.c
|
||||
"lwip/init.h"
|
||||
"apps/httpd.h"
|
||||
"lwip/debug.h"
|
||||
"lwip/stats.h"
|
||||
"apps/fs.h"
|
||||
"httpd_structs.h"
|
||||
"lwip/def.h"
|
||||
"lwip/altcp.h"
|
||||
"lwip/altcp_tcp.h"
|
||||
"lwip/altcp_tls.h"
|
||||
"lwip/sys.h"
|
||||
<string.h>
|
||||
<stdlib.h>
|
||||
<stdio.h>
|
||||
|
||||
1715152831 c:\users\lc\desktop\git\doubao_chat\include_lib\net\lwip_2_1_3\lwip\app\apps\httpd.h
|
||||
"httpd_opts.h"
|
||||
"lwip/err.h"
|
||||
"lwip/pbuf.h"
|
||||
|
||||
1715152831 c:\users\lc\desktop\git\doubao_chat\include_lib\net\lwip_2_1_3\lwip\app\apps\httpd_opts.h
|
||||
"lwip/opt.h"
|
||||
"lwip/prot/iana.h"
|
||||
|
||||
1715152831 c:\users\lc\desktop\git\doubao_chat\include_lib\net\lwip_2_1_3\lwip\app\apps\fs.h
|
||||
"httpd_opts.h"
|
||||
"lwip/err.h"
|
||||
|
||||
1729042160 c:\users\lc\desktop\git\doubao_chat\lib\net\lwip_2_1_3\apps\http\httpd_structs.h
|
||||
"apps/httpd.h"
|
||||
|
||||
1715152831 c:\users\lc\desktop\git\doubao_chat\include_lib\net\lwip_2_1_3\lwip\src\include\lwip\sys.h
|
||||
"lwip/opt.h"
|
||||
"lwip/err.h"
|
||||
"arch/sys_arch.h"
|
||||
|
||||
1715152831 c:\users\lc\desktop\git\doubao_chat\include_lib\net\lwip_2_1_3\lwip\port\arch\sys_arch.h
|
||||
"cc.h"
|
||||
"arch.h"
|
||||
"os/os_api.h"
|
||||
"os/os_cpu.h"
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -23,7 +23,7 @@
|
|||
#define CONFIG_DOUBLE_BANK_ENABLE 0//双备份方式升级
|
||||
#define CONFIG_IPERF_ENABLE // iperf测试
|
||||
#define CONFIG_AIRKISS_NET_CFG //AIRKISS配网
|
||||
//#define MEM_LEAK_CHECK_ENABLE //是否启用内存泄漏检查(需要包含mem_leak_test.h头文件)
|
||||
#define MEM_LEAK_CHECK_ENABLE //是否启用内存泄漏检查(需要包含mem_leak_test.h头文件)
|
||||
//#define CONFIG_ASSIGN_MACADDR_ENABLE //第一次开机连上外网后,使用杰理服务器分配WIFI模块的MAC地址, 关闭则使用<蓝牙地址更新工具*.exe>或者随机数作为MAC地址
|
||||
//#define SDTAP_DEBUG
|
||||
// #define CONFIG_STATIC_IPADDR_ENABLE //记忆路由器分配的IP,下次直接使用记忆IP节省DHCP时间
|
||||
|
|
|
|||
|
|
@ -168,12 +168,12 @@ static int playback_mode_init(void)
|
|||
}
|
||||
server_register_event_handler_to_task(pbh->dec_server, NULL, dec_server_event_handler, "app_core");
|
||||
|
||||
pbh->cache_buf = malloc(pbh->sample_rate * pbh->channel *500);
|
||||
pbh->cache_buf = malloc(pbh->sample_rate * pbh->channel *400);
|
||||
if (pbh->cache_buf == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
cbuf_init(&pbh->save_cbuf, pbh->cache_buf, pbh->sample_rate * pbh->channel * 500);
|
||||
cbuf_init(&pbh->save_cbuf, pbh->cache_buf, pbh->sample_rate * pbh->channel * 400);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ static int record_vfs_fwrite(void *file, void *data, u32 len)
|
|||
qmsg->end = 0;
|
||||
|
||||
argv[0]=(int)qmsg;
|
||||
err = os_taskq_post_type("websockets_stt_client_main_thread", Q_USER, 4, argv);
|
||||
err = os_taskq_post_type("websockets_stt_client_main_thread", Q_USER, 10, argv);
|
||||
if (err == OS_Q_FULL) {
|
||||
return len;
|
||||
}
|
||||
|
|
@ -230,7 +230,7 @@ static void record_run_task(void){
|
|||
|
||||
static void record_run_task_create(void)
|
||||
{
|
||||
thread_fork("record_run_task", 20, 1024 , 0, NULL, record_run_task, NULL);
|
||||
thread_fork("record_run_task", 15, 1024 , 0, NULL, record_run_task, NULL);
|
||||
}
|
||||
|
||||
static void record_start(void *priv)
|
||||
|
|
|
|||
|
|
@ -15,6 +15,13 @@
|
|||
|
||||
#define MAX_CONTENT_LENGTH 4*1024
|
||||
|
||||
#define MAX_MSG_LENGTH 5
|
||||
|
||||
typedef struct message_session{
|
||||
char role[10];
|
||||
char content[5*1024];
|
||||
}msg_session;
|
||||
|
||||
static char buffer[2*1024] = {0}; // 用于存储不完整数据块的缓冲区
|
||||
static size_t buffer_len = 0;
|
||||
|
||||
|
|
@ -22,10 +29,16 @@ char accumulated_content[10*1024] = {0};
|
|||
static size_t accumulated_length = 0;
|
||||
static size_t add_length = 0;
|
||||
|
||||
static msg_session msg_arr[MAX_MSG_LENGTH];
|
||||
|
||||
static int chat_index=0;
|
||||
|
||||
extern unsigned char chat_msg[4 * 1024];
|
||||
|
||||
extern OS_SEM chat_sem;
|
||||
|
||||
extern OS_MUTEX http_mutex;
|
||||
|
||||
OS_SEM tts_sem;
|
||||
|
||||
static void process_sse_chunk(const char *chunk)
|
||||
|
|
@ -41,6 +54,18 @@ static void process_sse_chunk(const char *chunk)
|
|||
if (strcmp(data_start, "[DONE]") == 0) {
|
||||
printf("SSE stream ended\r\n");
|
||||
printf("answer: %s\r\n",accumulated_content);
|
||||
if(chat_index>=MAX_MSG_LENGTH){
|
||||
chat_index = MAX_MSG_LENGTH-1;
|
||||
for (int i = 1; i < MAX_MSG_LENGTH; i++) {
|
||||
sprintf(msg_arr[i-1].role,"%s",msg_arr[i].role);
|
||||
sprintf(msg_arr[i-1].content,"%s",msg_arr[i].content);
|
||||
}
|
||||
}
|
||||
sprintf(msg_arr[chat_index].role,"%s","assistant");
|
||||
sprintf(msg_arr[chat_index].content,"%s",accumulated_content);
|
||||
if(chat_index<MAX_MSG_LENGTH){
|
||||
chat_index++;
|
||||
}
|
||||
} else {
|
||||
cJSON *json = cJSON_Parse(data_start);
|
||||
if (json) {
|
||||
|
|
@ -141,6 +166,19 @@ static void http_chat_task(void *priv)
|
|||
while(1){
|
||||
|
||||
os_sem_pend(&chat_sem, 0);
|
||||
if(chat_index>=MAX_MSG_LENGTH){
|
||||
chat_index = MAX_MSG_LENGTH-1;
|
||||
for (int i = 1; i < MAX_MSG_LENGTH; i++) {
|
||||
sprintf(msg_arr[i-1].role,"%s",msg_arr[i].role);
|
||||
sprintf(msg_arr[i-1].content,"%s",msg_arr[i].content);
|
||||
}
|
||||
}
|
||||
sprintf(msg_arr[chat_index].role,"%s","user");
|
||||
sprintf(msg_arr[chat_index].content,"%s",chat_msg);
|
||||
if(chat_index<MAX_MSG_LENGTH){
|
||||
chat_index++;
|
||||
}
|
||||
|
||||
|
||||
root = cJSON_CreateObject();
|
||||
if(!root){
|
||||
|
|
@ -156,18 +194,23 @@ static void http_chat_task(void *priv)
|
|||
goto fail;
|
||||
}
|
||||
|
||||
cJSON *session = cJSON_CreateObject();
|
||||
if(!session){
|
||||
goto fail;
|
||||
for(int i=0;i<chat_index;i++){
|
||||
cJSON *session = cJSON_CreateObject();
|
||||
if(!session){
|
||||
goto fail;
|
||||
}
|
||||
cJSON_AddStringToObject(session, "role", msg_arr[i].role);
|
||||
|
||||
cJSON_AddStringToObject(session, "content", msg_arr[i].content);
|
||||
|
||||
cJSON_AddItemToArray(messages, session);
|
||||
}
|
||||
|
||||
cJSON_AddStringToObject(session, "role", "user");
|
||||
|
||||
cJSON_AddStringToObject(session, "content", chat_msg);
|
||||
|
||||
cJSON_AddItemToArray(messages, session);
|
||||
|
||||
char *http_data = cJSON_Print(root);
|
||||
if(!http_data){
|
||||
goto fail;
|
||||
}
|
||||
//printf("http_data:%s\r\n",http_data);
|
||||
|
||||
cJSON_Delete(root);
|
||||
|
||||
|
|
@ -177,7 +220,10 @@ static void http_chat_task(void *priv)
|
|||
|
||||
memset(accumulated_content,0,MAX_CONTENT_LENGTH);
|
||||
accumulated_length = 0;
|
||||
|
||||
os_mutex_pend(&http_mutex, 0);
|
||||
httpc_get_file_dns(server_name, port, uri, &setting,http_rev_func, NULL, NULL);
|
||||
os_mutex_post(&http_mutex);
|
||||
|
||||
free(http_data);
|
||||
}
|
||||
|
|
@ -203,7 +249,7 @@ static void http_chat_start(void *priv)
|
|||
os_time_dly(1000);
|
||||
}
|
||||
|
||||
if (thread_fork("http_chat_task", 20, 1024 * 4, 0, NULL, http_chat_task, NULL) != OS_NO_ERR) {
|
||||
if (thread_fork("http_chat_task", 18, 1024 * 4, 0, NULL, http_chat_task, NULL) != OS_NO_ERR) {
|
||||
printf("thread fork fail\n");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -82,52 +82,26 @@ extern OS_SEM voice_start_sem;
|
|||
|
||||
OS_SEM chat_sem;
|
||||
|
||||
OS_MUTEX http_mutex;
|
||||
|
||||
static OS_SEM disconnet_sem;
|
||||
|
||||
unsigned char chat_msg[4 * 1024];
|
||||
|
||||
static void websockets_callback(u8 *buf, u32 len, u8 type)
|
||||
{
|
||||
int argv[4];
|
||||
int err;
|
||||
u8 *temp;
|
||||
if(buf!=NULL&&type!=0x89){
|
||||
|
||||
ParsedResponse *req=NULL;
|
||||
|
||||
printf(" . len: %d, . type: %x \r\n",len,type);
|
||||
|
||||
extern ParsedResponse* stt_parse_response(const uint8_t* res, size_t res_size);
|
||||
|
||||
req=stt_parse_response(buf, len);
|
||||
|
||||
printf(" . msg: %s\r\n",req->payload_msg);
|
||||
|
||||
cJSON* json = cJSON_Parse(req->payload_msg);
|
||||
|
||||
if(json!=NULL){
|
||||
cJSON *sequence = cJSON_GetObjectItem(json, "sequence");
|
||||
if(cJSON_IsNumber(sequence)){
|
||||
if(sequence->valueint<0){
|
||||
cJSON *results = cJSON_GetObjectItem(json, "result");
|
||||
if (cJSON_IsArray(results)) {
|
||||
int array_size = cJSON_GetArraySize(results);
|
||||
for (int i = 0; i < array_size; i++) {
|
||||
cJSON *result = cJSON_GetArrayItem(results, i);
|
||||
cJSON *text = cJSON_GetObjectItem(result,"text");
|
||||
if (cJSON_IsString(text) && (text->valuestring != NULL)) {
|
||||
printf("text: %s\r\n", (unsigned char*)text->valuestring);
|
||||
sprintf(chat_msg,"%s",text->valuestring);
|
||||
os_sem_set(&chat_sem,0);
|
||||
os_sem_post(&chat_sem);
|
||||
os_sem_set(&disconnet_sem,0);
|
||||
os_sem_post(&disconnet_sem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
temp = calloc(1,len+1);
|
||||
memcpy(temp,buf,len);
|
||||
argv[0]=(int)temp;
|
||||
argv[1]=len;
|
||||
err = os_taskq_post_type("websockets_stt_client_request_handle", Q_USER, 10, argv);
|
||||
if (err == OS_Q_FULL) {
|
||||
printf("post request err!\r\n");
|
||||
}
|
||||
if(req!=NULL)
|
||||
free(req);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -401,7 +375,7 @@ static void websockets_stt_client_main_thread(void *priv)
|
|||
{
|
||||
reconnet:
|
||||
int err;
|
||||
char mode = WEBSOCKET_MODE;
|
||||
char mode = WEBSOCKETS_MODE;
|
||||
u8 url[256] = OBJ_URL;
|
||||
const char *origin_str = "wss://openspeech.bytedance.com/api/v2/asr";
|
||||
const char *user_agent_str = "Authorization: Bearer; BNA-XBIrEisvMczcmc-Sm4B3H-PmfqlL";
|
||||
|
|
@ -438,6 +412,7 @@ reconnet:
|
|||
};
|
||||
|
||||
os_sem_create(&chat_sem,0);
|
||||
os_mutex_create(&http_mutex);
|
||||
|
||||
printf(" . ----------------- stt Client Websocket ------------------\r\n");
|
||||
|
||||
|
|
@ -457,12 +432,14 @@ reconnet:
|
|||
}
|
||||
|
||||
/* 3 . hanshack */
|
||||
os_mutex_pend(&http_mutex, 0);
|
||||
err = websockets_client_handshack(websockets_info);
|
||||
if (FALSE == err) {
|
||||
printf(" . ! Handshake error !!!\r\n");
|
||||
goto exit_ws;
|
||||
}
|
||||
printf(" . Handshake success \r\n");
|
||||
os_mutex_post(&http_mutex);
|
||||
|
||||
/* 4 . CreateThread */
|
||||
thread_fork("stt_websocket_client_heart", 19, 512, 0,
|
||||
|
|
@ -579,30 +556,30 @@ reconnet:
|
|||
if(rmsg->end){
|
||||
free(rmsg);
|
||||
os_sem_pend(&disconnet_sem,0);
|
||||
if (websockets_info->recv_thread_id) {
|
||||
thread_kill(&websockets_info->recv_thread_id, KILL_REQ);
|
||||
}
|
||||
|
||||
if (websockets_info->ping_thread_id) {
|
||||
thread_kill(&websockets_info->ping_thread_id, KILL_REQ);
|
||||
}
|
||||
if (websockets_info->recv_thread_id) {
|
||||
thread_kill(&websockets_info->recv_thread_id, KILL_REQ);
|
||||
}
|
||||
websockets_client_exit(websockets_info);
|
||||
free(websockets_info);
|
||||
|
||||
goto reconnet;
|
||||
}
|
||||
free(rmsg);
|
||||
if(rmsg!=NULL)
|
||||
free(rmsg);
|
||||
}
|
||||
|
||||
|
||||
exit_ws:
|
||||
/* 6 . exit */
|
||||
if (websockets_info->ping_thread_id) {
|
||||
thread_kill(&websockets_info->ping_thread_id, KILL_REQ);
|
||||
}
|
||||
if (websockets_info->recv_thread_id) {
|
||||
thread_kill(&websockets_info->recv_thread_id, KILL_REQ);
|
||||
}
|
||||
if (websockets_info->ping_thread_id) {
|
||||
thread_kill(&websockets_info->ping_thread_id, KILL_REQ);
|
||||
}
|
||||
websockets_client_exit(websockets_info);
|
||||
free(websockets_info);
|
||||
|
||||
|
|
@ -620,9 +597,69 @@ exit_ws:
|
|||
|
||||
}
|
||||
|
||||
static void websockets_stt_client_request_handle(void *priv){
|
||||
int err;
|
||||
int msg[32];
|
||||
u8 *buf;
|
||||
u32 len;
|
||||
while(1){
|
||||
err = os_taskq_pend("taskq", msg, ARRAY_SIZE(msg));
|
||||
if (err != OS_TASKQ || msg[0] != Q_USER) {
|
||||
continue;
|
||||
}
|
||||
buf = (u8 *)msg[1];
|
||||
len = msg[2];
|
||||
|
||||
ParsedResponse *req=NULL;
|
||||
|
||||
printf(" . len: %d",len);
|
||||
|
||||
req=stt_parse_response(buf, len);
|
||||
|
||||
free(buf);
|
||||
|
||||
printf(" . msg: %s\r\n",req->payload_msg);
|
||||
|
||||
cJSON* json = cJSON_Parse(req->payload_msg);
|
||||
|
||||
if(json!=NULL){
|
||||
cJSON *sequence = cJSON_GetObjectItem(json, "sequence");
|
||||
if(cJSON_IsNumber(sequence)){
|
||||
if(sequence->valueint<0){
|
||||
cJSON *results = cJSON_GetObjectItem(json, "result");
|
||||
if (cJSON_IsArray(results)) {
|
||||
int array_size = cJSON_GetArraySize(results);
|
||||
for (int i = 0; i < array_size; i++) {
|
||||
cJSON *result = cJSON_GetArrayItem(results, i);
|
||||
cJSON *text = cJSON_GetObjectItem(result,"text");
|
||||
if (cJSON_IsString(text) && (text->valuestring != NULL)) {
|
||||
printf("text: %s\r\n", (unsigned char*)text->valuestring);
|
||||
sprintf(chat_msg,"%s",text->valuestring);
|
||||
os_sem_set(&disconnet_sem,0);
|
||||
os_sem_post(&disconnet_sem);
|
||||
|
||||
os_sem_set(&chat_sem,0);
|
||||
os_sem_post(&chat_sem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
cJSON_Delete(json);
|
||||
}
|
||||
if(req!=NULL)
|
||||
free(req);
|
||||
}
|
||||
}
|
||||
|
||||
static void stt_websocket_client_thread_create(void)
|
||||
{
|
||||
thread_fork("websockets_stt_client_main_thread", 20, 1024 * 6, 256, 0, websockets_stt_client_main_thread, NULL);
|
||||
thread_fork("websockets_stt_client_main_thread", 16, 1024 * 8, 512, 0, websockets_stt_client_main_thread, NULL);
|
||||
}
|
||||
|
||||
static void websockets_stt_client_request_handle_create(void)
|
||||
{
|
||||
thread_fork("websockets_stt_client_request_handle",20,1024 * 2, 512, 0,websockets_stt_client_request_handle,NULL);
|
||||
}
|
||||
|
||||
static void stt_http_websocket_start(void *priv)
|
||||
|
|
@ -640,6 +677,7 @@ static void stt_http_websocket_start(void *priv)
|
|||
}
|
||||
|
||||
stt_websocket_client_thread_create();
|
||||
websockets_stt_client_request_handle_create();
|
||||
}
|
||||
|
||||
//应用程序入口,需要运行在STA模式下
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
#include "spiflash.h"
|
||||
#include "event/device_event.h"
|
||||
|
||||
|
||||
#define tts
|
||||
#ifdef tts
|
||||
|
||||
|
|
@ -80,6 +81,9 @@ static void websockets_callback(u8 *buf, u32 len, u8 type)
|
|||
extern char* tts_parse_response(uint8_t *res,int *len);
|
||||
|
||||
tts_req = calloc(1,sizeof(struct tts_response));
|
||||
if(!tts_req){
|
||||
perror("Failed to allocate memory");
|
||||
}
|
||||
|
||||
tts_req->msg = tts_parse_response(buf,&req_len);
|
||||
tts_req->len = req_len;
|
||||
|
|
@ -354,7 +358,7 @@ static void generate_uuid(char *uuid_out)
|
|||
static void websockets_tts_client_main_thread(void *priv)
|
||||
{
|
||||
int err;
|
||||
char mode = WEBSOCKET_MODE;
|
||||
char mode = WEBSOCKETS_MODE;
|
||||
u8 url[256] = OBJ_URL;
|
||||
const char *origin_str = "openspeech.bytedance.com";
|
||||
const char *user_agent_str = "Authorization: Bearer; BNA-XBIrEisvMczcmc-Sm4B3H-PmfqlL";
|
||||
|
|
@ -530,7 +534,7 @@ exit_ws:
|
|||
|
||||
static void tts_websocket_client_thread_create(void)
|
||||
{
|
||||
thread_fork("websockets_tts_client_main_thread", 20, 1024 * 6, 1024, 0, websockets_tts_client_main_thread, NULL);
|
||||
thread_fork("websockets_tts_client_main_thread", 15, 1024 * 6, 1024, 0, websockets_tts_client_main_thread, NULL);
|
||||
}
|
||||
|
||||
static void tts_http_websocket_start(void *priv)
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
|
@ -139,7 +139,7 @@ typedef struct _httpc_connection {
|
|||
httpc_headers_done_fn headers_done_fn;
|
||||
|
||||
u8_t use_post;
|
||||
u8_t arglen;
|
||||
u32_t arglen;
|
||||
u8_t* args;
|
||||
u8_t* authorization;
|
||||
} httpc_connection_t;
|
||||
|
|
|
|||
Loading…
Reference in New Issue