Skip to content

Commit

Permalink
feat: ai copilot & v 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
meta-d committed Jan 26, 2024
1 parent d3d9c9e commit ab7aec4
Show file tree
Hide file tree
Showing 14 changed files with 65 additions and 20 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,17 @@

**English** | [**中文**](./README_zh.md)

## 💡 What's New

The BTP Fiori template project has now incorporated the AI Copilot feature, which can assist you in handling everyday tasks using AI. It can answer questions you ask and can also automate operations through custom commands. You can find more information on how to use it on the [AI Copilot](./docs/copilot/Setup.md) page.

## 🌟 What is this?

This is a collection of SAP BTP & Fiori application templates built by third-party front-end frameworks (Angular, Vue, React, etc.). It is based on [Nx](https://nx.dev) and [UI5 Tooling](https://sap.github.io/ui5-tooling/).

There are several advantages to using open-source frameworks to create BTP & Fiori applications:

* The AI Copilot feature can answer your questions and also enable automation through custom commands.
* A robust ecosystem and active developer community that provide solutions, sample code, and plugins.
* Rich component libraries and templates.
* Cross-platform consistency, supporting responsive design to adapt to various screen sizes and devices.
Expand Down Expand Up @@ -72,6 +77,10 @@ We plan to provide project templates in multiple frameworks and multiple combina

## 🌼 Screenshots

### AI Copilot

<img src="./docs/images/copilot/copilot-chat-in-bi.png" alt="Copilot Screenshot" height="auto" width="100%" style="border-radius: 10px;">

### Side Menu Bar

<img src="./docs/images/side-menu-bar-fiori-app.png" alt="Side Menu Bar Screenshot" height="auto" width="100%" style="border-radius: 10px;">
Expand Down
10 changes: 10 additions & 0 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,17 @@

[**English**](./README.md) | **中文**

## 💡 新功能

BTP Fiori 模板项目现已加入 AI Copilot 功能,它可以帮助您使用 AI 处理日常事务。她可以回答您提问的问题,还可以通过自定义命令来实现自动化操作。
您可以在 [AI Copilot](./docs/copilot/Setup.md) 页面了解更多使用信息。

## 🌟 这是什么?

这是一个由第三方前端框架(Angular、Vue、React等)构建的 SAP BTP & Fiori 应用程序模板集合。它基于 [Nx](https://nx.dev)[UI5 Tooling](https://sap.github.io/ui5-tooling/)

使用开源框架来创建 BTP & Fiori 应用有很多优势:
* AI Copilot 功能,可以回答您提问的问题,还可以通过自定义命令来实现自动化操作。
* 强大的生态系统和活跃的开发社区,提供了问题解决方案、示例代码和插件。
* 丰富的组件库和模板。
* 跨平台一致性,支持响应式设计,使应用程序能够适应不同的屏幕尺寸和设备。
Expand Down Expand Up @@ -71,6 +77,10 @@

## 🌼 屏幕截图

### 人工智能副驾驶

<img src="./docs/images/copilot/copilot-chat-in-bi.png" alt="Copilot Screenshot" height="auto" width="100%" style="border-radius: 10px;">

### 侧边菜单模式

<img src="./docs/images/side-menu-bar-fiori-app.png" alt="Side Menu Bar Screenshot" height="auto" width="100%" style="border-radius: 10px;">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ export class ZngOcapSchemaComponent {
}

dimension = signal<ChartDimension>({
...this.customerCountry,
dimension: '[2CICALENDARYEAR]',
hierarchy: '[2CICALENDARYEAR]',
level: '[2CICALENDARYEAR].[LEVEL01]',
zeroSuppression: true
})
measure = signal<ChartMeasure>({
Expand All @@ -156,7 +158,7 @@ export class ZngOcapSchemaComponent {
},
chartOptions: {
seriesStyle: {
barWidth: 5
// barWidth: 5
}
},
palette: {
Expand Down Expand Up @@ -227,11 +229,15 @@ ${makeCubePrompt(entityType)}
}),
measure: z.object({
measure: z.string().describe('The measure'),
palette: z.object({
name: z.enum(['BrBG', 'PRGn', 'PiYG', 'Spectral', 'RdBu', 'RdGy', 'RdYlBu', 'RdYlGn', 'PuOr']).describe('palette name of colors'),
// colors: z.string().array().optional().describe('The colors of palette, min 5 colors')
}).optional().describe('The palette of measure series'),
chartOptions: z
.object({
seriesStyle: z
.object({
barWidth: z.number().describe('Bar width')
barMaxWidth: z.number().optional().describe('Bar max width'),
})
.optional()
.describe('ECharts series options')
Expand Down Expand Up @@ -263,6 +269,8 @@ ${makeCubePrompt(entityType)}
...chart.measure,
order: OrderDirection.DESC
})

return `New chart success`
}
}),
injectMakeCopilotActionable({
Expand Down Expand Up @@ -377,12 +385,30 @@ ${makeCubePrompt(entityType)}
calculationType: CalculationType.Calculated,
formula
} as CalculatedProperty)
return `创建计算度量成功`
return `New calculated measure success`
}
}),
})
]
})

#askCommand = injectCopilotCommand({
name: 'ask',
description: 'Ask a question',
systemPrompt: () => {
let prompt = `Answer the question ref to cube. `
const entityType = this.entityType()
if (entityType) {
prompt += `The cube is:
\`\`\`
${makeCubePrompt(entityType)}
\`\`\`
`
}
return prompt
},
actions: []
})

onResize({ col }: NzResizeEvent): void {
cancelAnimationFrame(this.id)
this.id = requestAnimationFrame(() => {
Expand Down
4 changes: 2 additions & 2 deletions btp-cap-monorepo/apps/launchpad/src/app/bi/services/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from './s4-agent.service'
export * from './s4-ds-core.service'
export * from './s4h-agent.service'
export * from './s4h-ocap-core.service'
export * from './translate.service'
export * from './ocap-cache.service'
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export const usePersStore = () => {
}

export async function upsertPersonalization(value: Partial<PersContainer>) {
const { save, update } = persStore
return await (value.ID ? update('PersContainers', { ID: value.ID }, value) : save('PersContainers', value))
const { create, update } = persStore
return await (value.ID ? update('PersContainers', { ID: value.ID }, value) : create('PersContainers', value))
}

export async function readPersonalization(appId: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ export class S4AppStoreService implements IAppStore {
}

async savePersonalization() {
const { save } = useINTEROPStore()
const { create } = useINTEROPStore()

const value = this.state$.value.personalization.value

const containerCategory = 'P'
await save('PersContainers', {
await create('PersContainers', {
id: PersContainerId,
category: containerCategory,
validity: 0,
Expand Down
8 changes: 4 additions & 4 deletions btp-cap-monorepo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metad/btp-cap-monorepo",
"version": "0.0.18",
"version": "0.1.0",
"license": "MIT",
"scripts": {
"start": "yarn start:btp",
Expand Down Expand Up @@ -38,9 +38,9 @@
"@antv/g2plot": "^2.4.31",
"@antv/x6": "^2.16.1",
"@antv/x6-plugin-dnd": "^2.1.1",
"@metad/copilot": "1.18.0-beta.3",
"@metad/ocap-angular": "1.18.0-beta.3",
"@metad/ocap-core": "1.18.0-beta.3",
"@metad/copilot": "1.18.0-beta.4",
"@metad/ocap-angular": "1.18.0-beta.4",
"@metad/ocap-core": "1.18.0-beta.4",
"@metad/ocap-echarts": "1.17.0",
"@metad/ocap-xmla": "1.17.0",
"@metad/store": "1.17.0",
Expand Down
2 changes: 1 addition & 1 deletion btp-cap-monorepo/packages/contracts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metad/cap-contracts",
"version": "0.0.18",
"version": "0.1.0",
"dependencies": {},
"main": "./index.js",
"module": "./index.mjs",
Expand Down
2 changes: 1 addition & 1 deletion btp-cap-monorepo/packages/odata/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metad/cap-odata",
"version": "0.0.19",
"version": "0.1.0",
"homepage": "https://mtda.cloud/en/sap",
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions btp-cap-monorepo/packages/odata/src/lib/odata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export function defineODataStore(
})
}

const save = async <T = any>(entitySet: string, body: T, options?: ODataQueryOptions): Promise<T> => {
const create = async <T = any>(entitySet: string, body: T, options?: ODataQueryOptions): Promise<T> => {
const url = `${baseUrl}/${entitySet}`

const reqOptions = {
Expand Down Expand Up @@ -365,7 +365,7 @@ export function defineODataStore(
entityType,
read,
query,
save,
create,
update,
count,
remove,
Expand Down
2 changes: 1 addition & 1 deletion btp-cap-monorepo/packages/odata/src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export type ODataStore = {
* @param options
* @returns
*/
save: <T>(entitySet: string, data: T, options?: ODataQueryOptions) => Promise<T>
create: <T>(entitySet: string, data: T, options?: ODataQueryOptions) => Promise<T>

/**
* Query entities using ODataQueryOptions
Expand Down
Binary file added docs/images/copilot/copilot-chat-in-bi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ab7aec4

Please sign in to comment.