Skip to content

Commit 54566cd

Browse files
yingtao450claude
andcommitted
refactor(ai_picture): replace hardcoded recognize prompt with RECOGNIZE_IMAGE_PROMPT macro
Include lang_config.h and use the language-aware macro so the prompt switches automatically between Chinese and English at build time. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent a9e38a4 commit 54566cd

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

apps/tuya.ai/ai_components/ai_picture/src/ai_picture_input.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*/
99
#include "string.h"
1010
#include "tal_api.h"
11+
#include "lang_config.h"
1112
#include "tuya_ai_agent.h"
1213
#include "ai_user_event.h"
1314
#include "ai_agent.h"
@@ -195,15 +196,16 @@ uint32_t ai_picture_input_get_num(void)
195196
OPERATE_RET ai_picture_input_recognize(uint8_t *data, uint32_t len)
196197
{
197198
OPERATE_RET rt = OPRT_OK;
198-
char *text = "explain the content of the uploaded image, do not trigger MCP skills, do not call MCP tools";
199+
uint64_t timestamp = tal_system_get_millisecond();
200+
char *text = RECOGNIZE_IMAGE_PROMPT;
199201

200202
if (NULL == data || 0 == len) {
201203
return OPRT_INVALID_PARM;
202204
}
203205

204206
tuya_ai_input_start(TRUE);
205-
TUYA_CALL_ERR_LOG(ai_agent_send_image((uint8_t *)data, len));
206-
TUYA_CALL_ERR_LOG(ai_agent_send_text(text));
207+
TUYA_CALL_ERR_RETURN(tuya_ai_image_input(timestamp, (uint8_t *)data, len, len));
208+
TUYA_CALL_ERR_RETURN(tuya_ai_text_input((uint8_t *)text, strlen(text), strlen(text)));
207209
tuya_ai_input_stop();
208210

209211
return rt;

0 commit comments

Comments
 (0)