Skip to content

Commit 91317d1

Browse files
committed
feat(harmonyos): update documentation and chat context provider
- Updated the documentation in the HarmonyOS Extension README file to include information about the remote API being used. - Modified the HarmonyOSChatContextProvider to provide more context information. - The context now includes the main language used (TypeScript, JavaScript, or ArkTS) and mentions the Flutter-like UI framework being used. - This will enhance the user experience when working with HarmonyOS projects.
1 parent 37f323d commit 91317d1

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

exts/ext-harmonyos/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# HarmonyOS Extension
22

3-
openharmony/lib/ohos-info-center-plugin-3.1.0.501, API Reference
3+
openharmony/lib/ohos-info-center-plugin-3.1.0.501, API Reference,可惜使用的是远程 API 。
44
openharmony/lib/javascript-3.1.0.501.jar, 自研 JavaScript 模块
55

6+
7+
68
## 设计思念
79

810
三个新要素:新的语言、遗留系统迁移、新的 UI 框架。

exts/ext-harmonyos/src/main/kotlin/cc/unitmesh/harmonyos/provider/HarmonyOSChatContextProvider.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ class HarmonyOSChatContextProvider : ChatContextProvider {
1111
}
1212

1313
override suspend fun collect(project: Project, creationContext: ChatCreationContext): List<ChatContextItem> {
14-
return listOf(ChatContextItem(HarmonyOSChatContextProvider::class, "This project is a HarmonyOS project."))
14+
var context = "This project is a HarmonyOS project."
15+
16+
val languageName = creationContext.element?.language?.displayName
17+
18+
if (languageName == "TypeScript" || languageName == "JavaScript" || languageName == "ArkTS") {
19+
context += "Which use TypeScript as the main language, and use Flutter like UI framework."
20+
}
21+
22+
return listOf(ChatContextItem(HarmonyOSChatContextProvider::class, context))
1523
}
1624
}

0 commit comments

Comments
 (0)