添加胜算云认证。
This commit is contained in:
commit
ea6203cf55
41 files changed
+146
-246
No files matched your search
@@ -1,5 +1,5 @@
|
||||
---
|
||||
"claude-dev": patch
|
||||
"cline-chinese": patch
|
||||
---
|
||||
|
||||
Fix Workspace and Favorites history filters to work independently instead of being mutually exclusive
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
"claude-dev": patch
|
||||
"cline-chinese": patch
|
||||
---
|
||||
|
||||
Add a new api provider.
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
"claude-dev": patch
|
||||
"cline-chinese": patch
|
||||
---
|
||||
|
||||
fix regression that broke JSON parsing for SAP AI Core provider in native API mode for claude models
|
||||
@@ -9,7 +9,7 @@ For reference, here are some examples of how we converted previous changesets to
|
||||
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or setup this action to publish automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.
|
||||
|
||||
Releases
|
||||
claude-dev@3.14.0
|
||||
cline-chinese@3.14.0
|
||||
Minor Changes
|
||||
77c9863: create clinerules folder if its currently a file and creating new rule
|
||||
0ffb7dd: disabling shift hint for now & improving tooltip behavior
|
||||
@@ -369,7 +369,7 @@ This PR was opened by the [Changesets release](https://github.com/changesets/act
|
||||
|
||||
|
||||
# Releases
|
||||
## claude-dev@3.16.0
|
||||
## cline-chinese@3.16.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
|
||||
@@ -331,7 +331,7 @@ Hey, the PR looks good overall but I'm concerned about removing those timeouts.
|
||||
Could you add back the timeouts after focusing the sidebar? Something like:
|
||||
|
||||
```typescript
|
||||
await vscode.commands.executeCommand("claude-dev.SidebarProvider.focus")
|
||||
await vscode.commands.executeCommand("cline-chinese.SidebarProvider.focus")
|
||||
await setTimeoutPromise(100) // Give UI time to update
|
||||
visibleWebview = WebviewProvider.getSidebarInstance()
|
||||
```
|
||||
|
||||
Vendored
+4
-4
@@ -13,7 +13,7 @@
|
||||
"--extensionDevelopmentPath=${workspaceFolder}",
|
||||
"--disable-workspace-trust",
|
||||
"--disable-extension",
|
||||
"saoudrizwan.claude-dev", // Avoid conflicts with installed Cline
|
||||
"saoudrizwan.cline-chinese", // Avoid conflicts with installed Cline
|
||||
"--disable-extension",
|
||||
"saoudrizwan.cline-nightly", // Avoid conflicts with installed Cline Nightly
|
||||
"${workspaceFolder}"
|
||||
@@ -37,7 +37,7 @@
|
||||
"--extensionDevelopmentPath=${workspaceFolder}",
|
||||
"--disable-workspace-trust",
|
||||
"--disable-extension",
|
||||
"saoudrizwan.claude-dev", // Avoid conflicts with installed Cline
|
||||
"saoudrizwan.cline-chinese", // Avoid conflicts with installed Cline
|
||||
"--disable-extension",
|
||||
"saoudrizwan.cline-nightly", // Avoid conflicts with installed Cline Nightly
|
||||
"${workspaceFolder}"
|
||||
@@ -61,7 +61,7 @@
|
||||
"--extensionDevelopmentPath=${workspaceFolder}",
|
||||
"--disable-workspace-trust",
|
||||
"--disable-extension",
|
||||
"saoudrizwan.claude-dev", // Avoid conflicts with installed Cline
|
||||
"saoudrizwan.cline-chinese", // Avoid conflicts with installed Cline
|
||||
"--disable-extension",
|
||||
"saoudrizwan.cline-nightly", // Avoid conflicts with installed Cline Nightly
|
||||
"${workspaceFolder}"
|
||||
@@ -87,7 +87,7 @@
|
||||
"--profile-temp",
|
||||
"--sync=off",
|
||||
"--disable-extension",
|
||||
"saoudrizwan.claude-dev", // Avoid conflicts with installed Cline
|
||||
"saoudrizwan.cline-chinese", // Avoid conflicts with installed Cline
|
||||
"--disable-extension",
|
||||
"saoudrizwan.cline-nightly", // Avoid conflicts with installed Cline Nightly
|
||||
"--extensionDevelopmentPath=${workspaceFolder}",
|
||||
|
||||
@@ -84,8 +84,8 @@ Reka AI |Reka Core
|
||||
国际
|
||||
Github: https://github.com/SSYCloud/cline-chinese-ssy <br>
|
||||
中国大陆<br>
|
||||
Gitcode:https://gitcode.com/shengsuan-cloud/cline-chinese-ssy<br>
|
||||
Gitee: https://gitee.com/shengsuan-cloud/cline-chinese-ssy<br>
|
||||
Gitcode:https://gitcode.com/HybridTalentComputing/cline-chinese-ssy<br>
|
||||
Gitee: https://gitee.com/HybridTalentComputing/cline-chinese-ssy<br>
|
||||
---
|
||||
## 文档地址(包括使用方法,MCP知识,常见问题解答等)<br>
|
||||
https://modelmesh.gitbook.io/cline-zhong-wen-ban-docs/<br>
|
||||
@@ -93,10 +93,10 @@ https://modelmesh.gitbook.io/cline-zhong-wen-ban-docs/<br>
|
||||
## 其他支持插件
|
||||
|
||||
Kilo SSY Code Agent<br>
|
||||
https://marketplace.visualstudio.com/items?itemName=shengsuan-cloud.kilo-ssy<br>
|
||||
https://marketplace.visualstudio.com/items?itemName=HybridTalentComputing.kilo-ssy<br>
|
||||
|
||||
Roo Code Chinese SSY<br>
|
||||
https://marketplace.visualstudio.com/items?itemName=shengsuan-cloud.roo-vibecoding<br>
|
||||
https://marketplace.visualstudio.com/items?itemName=HybridTalentComputing.roo-vibecoding<br>
|
||||
|
||||
---
|
||||
## 欢迎关注我的自媒体账号
|
||||
|
||||
@@ -29,7 +29,7 @@ Cline 配备以下内置键盘快捷键来简化您的工作流程:
|
||||
| [`cline.explainCode`](/features/commands-and-shortcuts/code-commands) | 解释选中的代码 |
|
||||
| [`cline.improveCode`](/features/commands-and-shortcuts/code-commands) | 为选中的代码建议改进 |
|
||||
| [`cline.fixWithCline`](/features/commands-and-shortcuts/code-commands) | 修复有错误的代码 |
|
||||
| `claude-dev.SidebarProvider.focus` | 打开并聚焦 Cline 侧边栏 |
|
||||
| `cline-chinese.SidebarProvider.focus` | 打开并聚焦 Cline 侧边栏 |
|
||||
|
||||
## 自定义键盘快捷键
|
||||
|
||||
@@ -54,7 +54,7 @@ Cline 配备以下内置键盘快捷键来简化您的工作流程:
|
||||
|
||||
| 操作 | 建议快捷键 | 命令 ID | 描述 |
|
||||
| --------------------- | ------------------------------ | ----------------------------------------- | ----------------------------- |
|
||||
| 打开 Cline 侧边栏 | `Ctrl+Shift+C` / `Cmd+Shift+C` | `claude-dev.SidebarProvider.focus` | 打开 Cline 侧边栏面板 |
|
||||
| 打开 Cline 侧边栏 | `Ctrl+Shift+C` / `Cmd+Shift+C` | `cline-chinese.SidebarProvider.focus` | 打开 Cline 侧边栏面板 |
|
||||
| 新任务 | `Alt+N` | `cline.plusButtonClicked` | 启动新的 Cline 任务 |
|
||||
| 将终端添加到 Cline | `Alt+T` | `cline.addTerminalOutputToChat` | 将终端输出添加到 Cline |
|
||||
| 清除当前任务 | `Alt+C` | (需要自定义键绑定到 UI 操作) | 清除当前任务 |
|
||||
|
||||
@@ -385,7 +385,7 @@ Hey, the PR looks good overall but I'm concerned about removing those timeouts.
|
||||
Could you add back the timeouts after focusing the sidebar? Something like:
|
||||
|
||||
```typescript
|
||||
await vscode.commands.executeCommand("claude-dev.SidebarProvider.focus")
|
||||
await vscode.commands.executeCommand("cline-chinese.SidebarProvider.focus")
|
||||
await setTimeoutPromise(100) // Give UI time to update
|
||||
visibleWebview = WebviewProvider.getSidebarInstance()
|
||||
```
|
||||
|
||||
@@ -56,7 +56,7 @@ MCP 市场为各种类别的数百个 MCP 服务器提供一键安装体验。
|
||||
### 2. 配置
|
||||
|
||||
- MCP 设置文件使用您的服务器配置进行更新
|
||||
- 此文件位于:`/Users/<username>/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json`
|
||||
- 此文件位于:`/Users/<username>/Library/Application Support/Code/User/globalStorage/saoudrizwan.cline-chinese/settings/cline_mcp_settings.json`
|
||||
- 环境变量(如 API 密钥)被安全存储
|
||||
- 注册服务器路径
|
||||
|
||||
@@ -109,7 +109,7 @@ MCP 市场为各种类别的数百个 MCP 服务器提供一键安装体验。
|
||||
|
||||
要完全删除有问题的 MCP 服务器:
|
||||
|
||||
1. 打开 MCP 设置文件:`/Users/<username>/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json`
|
||||
1. 打开 MCP 设置文件:`/Users/<username>/Library/Application Support/Code/User/globalStorage/saoudrizwan.cline-chinese/settings/cline_mcp_settings.json`
|
||||
2. 从 `mcpServers` 对象中删除服务器的整个条目
|
||||
3. 保存文件
|
||||
4. 重启 Cline
|
||||
|
||||
@@ -38,21 +38,21 @@ Sometimes when you update Cline or when certain settings change, you might lose
|
||||
<Tab title="VS Code">
|
||||
```bash
|
||||
# macOS
|
||||
~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/
|
||||
~/Library/Application Support/Code/User/globalStorage/saoudrizwan.cline-chinese/
|
||||
# Windows
|
||||
%APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\
|
||||
%APPDATA%\Code\User\globalStorage\saoudrizwan.cline-chinese\
|
||||
# Linux
|
||||
~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/
|
||||
~/.config/Code/User/globalStorage/saoudrizwan.cline-chinese/
|
||||
```
|
||||
</Tab>
|
||||
<Tab title="JetBrains">
|
||||
```bash
|
||||
# macOS
|
||||
~/Library/Application Support/JetBrains/<IDE>/globalStorage/saoudrizwan.claude-dev/
|
||||
~/Library/Application Support/JetBrains/<IDE>/globalStorage/saoudrizwan.cline-chinese/
|
||||
# Windows
|
||||
%APPDATA%\JetBrains\<IDE>\globalStorage\saoudrizwan.claude-dev\
|
||||
%APPDATA%\JetBrains\<IDE>\globalStorage\saoudrizwan.cline-chinese\
|
||||
# Linux
|
||||
~/.config/JetBrains/<IDE>/globalStorage/saoudrizwan.claude-dev/
|
||||
~/.config/JetBrains/<IDE>/globalStorage/saoudrizwan.cline-chinese/
|
||||
```
|
||||
</Tab>
|
||||
</Tabs>
|
||||
@@ -62,7 +62,7 @@ For VS Code Insiders, replace `Code` with `Code - Insiders`. For JetBrains IDEs,
|
||||
### Directory Structure
|
||||
|
||||
```
|
||||
saoudrizwan.claude-dev/
|
||||
saoudrizwan.cline-chinese/
|
||||
├── state/
|
||||
│ ├── taskHistory.json # Main history index
|
||||
│ └── taskHistory.backup.*.json # Backups
|
||||
@@ -112,7 +112,7 @@ Cline creates backups automatically. Find them in the `state/` folder:
|
||||
<Tab title="VS Code">
|
||||
```bash
|
||||
# macOS/Linux
|
||||
cd ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/state/
|
||||
cd ~/.config/Code/User/globalStorage/saoudrizwan.cline-chinese/state/
|
||||
ls taskHistory.backup.*.json
|
||||
|
||||
# Pick the most recent one and restore it
|
||||
@@ -122,7 +122,7 @@ Cline creates backups automatically. Find them in the `state/` folder:
|
||||
<Tab title="JetBrains">
|
||||
```bash
|
||||
# macOS
|
||||
cd ~/Library/Application\ Support/JetBrains/<IDE>/globalStorage/saoudrizwan.claude-dev/state/
|
||||
cd ~/Library/Application\ Support/JetBrains/<IDE>/globalStorage/saoudrizwan.cline-chinese/state/
|
||||
ls taskHistory.backup.*.json
|
||||
|
||||
# Pick the most recent one and restore it
|
||||
@@ -137,7 +137,7 @@ Switching to a new computer? You can bring all your Cline conversations with you
|
||||
|
||||
<Steps>
|
||||
<Step title="Locate and copy your Cline data">
|
||||
On your **old machine**, find the `saoudrizwan.claude-dev` folder using the [storage paths above](#storage-paths) and copy the entire folder.
|
||||
On your **old machine**, find the `saoudrizwan.cline-chinese` folder using the [storage paths above](#storage-paths) and copy the entire folder.
|
||||
</Step>
|
||||
<Step title="Set up your new machine">
|
||||
On your **new machine**, install your IDE (VS Code or JetBrains) and the Cline extension.
|
||||
@@ -146,7 +146,7 @@ Switching to a new computer? You can bring all your Cline conversations with you
|
||||
Make sure your IDE is completely closed before proceeding.
|
||||
</Step>
|
||||
<Step title="Transfer your data">
|
||||
Paste the `saoudrizwan.claude-dev` folder to the same storage path on your new machine.
|
||||
Paste the `saoudrizwan.cline-chinese` folder to the same storage path on your new machine.
|
||||
</Step>
|
||||
<Step title="Launch and verify">
|
||||
Open your IDE. Your task history should now appear in Cline.
|
||||
|
||||
@@ -121,7 +121,7 @@ export async function spawnVSCode(workspacePath: string, vsixPath?: string): Pro
|
||||
// Show the activity bar and sidebar
|
||||
"workbench.activityBar.visible": true,
|
||||
"workbench.sideBar.visible": true,
|
||||
"workbench.view.extension.shengsuan-cloud.cline-shengsuan-ActivityBar.visible": true,
|
||||
"workbench.view.extension.HybridTalentComputing.cline-chinese-ActivityBar.visible": true,
|
||||
"workbench.view.alwaysShowHeaderActions": true,
|
||||
"workbench.editor.openSideBySideDirection": "right",
|
||||
|
||||
@@ -145,13 +145,13 @@ export async function spawnVSCode(workspacePath: string, vsixPath?: string): Pro
|
||||
const keybindings = [
|
||||
{
|
||||
key: "alt+c",
|
||||
command: "workbench.view.extension.shengsuan-cloud.cline-shengsuan-ActivityBar",
|
||||
when: "viewContainer.workbench.view.extension.shengsuan-cloud.cline-shengsuan-ActivityBar.enabled",
|
||||
command: "workbench.view.extension.HybridTalentComputing.cline-chinese-ActivityBar",
|
||||
when: "viewContainer.workbench.view.extension.HybridTalentComputing.cline-chinese-ActivityBar.enabled",
|
||||
},
|
||||
{
|
||||
key: "alt+shift+c",
|
||||
command: "cline.openInNewTab",
|
||||
when: "viewContainer.workbench.view.extension.shengsuan-cloud.cline-shengsuan-ActivityBar.enabled",
|
||||
when: "viewContainer.workbench.view.extension.HybridTalentComputing.cline-chinese-ActivityBar.enabled",
|
||||
},
|
||||
]
|
||||
fs.writeFileSync(keybindingsPath, JSON.stringify(keybindings, null, 2))
|
||||
@@ -171,10 +171,10 @@ export async function spawnVSCode(workspacePath: string, vsixPath?: string): Pro
|
||||
workspacePath,
|
||||
// Force the extension to be activated on startup
|
||||
"--start-up-extension",
|
||||
"shengsuan-cloud.cline-shengsuan",
|
||||
"HybridTalentComputing.cline-chinese",
|
||||
// Run a command on startup to open Cline
|
||||
"--command",
|
||||
"workbench.view.extension.shengsuan-cloud.cline-shengsuan-ActivityBar",
|
||||
"workbench.view.extension.HybridTalentComputing.cline-chinese-ActivityBar",
|
||||
// Additional flags to help with extension activation
|
||||
"--disable-gpu=false",
|
||||
"--max-memory=4096",
|
||||
@@ -186,7 +186,7 @@ export async function spawnVSCode(workspacePath: string, vsixPath?: string): Pro
|
||||
// This script will be executed when VS Code starts
|
||||
setTimeout(() => {
|
||||
// Try to open Cline in the sidebar
|
||||
require('vscode').commands.executeCommand('workbench.view.extension.shengsuan-cloud.cline-shengsuan-ActivityBar');
|
||||
require('vscode').commands.executeCommand('workbench.view.extension.HybridTalentComputing.cline-chinese-ActivityBar');
|
||||
|
||||
// Also try to open Cline in a tab as a fallback
|
||||
setTimeout(() => {
|
||||
@@ -270,7 +270,7 @@ export async function spawnVSCode(workspacePath: string, vsixPath?: string): Pro
|
||||
let disposable = vscode.commands.registerCommand('cline-activator.activate', async function () {
|
||||
try {
|
||||
// Make sure the Cline extension is activated
|
||||
const extension = vscode.extensions.getExtension('shengsuan-cloud.cline-shengsuan');
|
||||
const extension = vscode.extensions.getExtension('HybridTalentComputing.cline-chinese');
|
||||
if (!extension) {
|
||||
console.error('Cline extension not found');
|
||||
return;
|
||||
@@ -283,7 +283,7 @@ export async function spawnVSCode(workspacePath: string, vsixPath?: string): Pro
|
||||
|
||||
// Show the Cline sidebar
|
||||
console.log('Opening Cline sidebar...');
|
||||
await vscode.commands.executeCommand('workbench.view.extension.shengsuan-cloud.cline-shengsuan-ActivityBar');
|
||||
await vscode.commands.executeCommand('workbench.view.extension.HybridTalentComputing.cline-chinese-ActivityBar');
|
||||
|
||||
// Wait a moment for the sidebar to initialize
|
||||
await new Promise(resolve => setTimeout(resolve, 2000));
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<table>
|
||||
<tbody>
|
||||
<td align="center">
|
||||
<a href="https://marketplace.visualstudio.com/items?itemName=shengsuan-cloud.cline-shengsuan" target="_blank"><strong>تنزيل من متجر VS</strong></a>
|
||||
<a href="https://marketplace.visualstudio.com/items?itemName=HybridTalentComputing.cline-chinese" target="_blank"><strong>تنزيل من متجر VS</strong></a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://discord.gg/cline" target="_blank"><strong>Discord</strong></a>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<table>
|
||||
<tbody>
|
||||
<td align="center">
|
||||
<a href="https://marketplace.visualstudio.com/items?itemName=shengsuan-cloud.cline-shengsuan" target="_blank"><strong>Im VS Marketplace herunterladen</strong></a>
|
||||
<a href="https://marketplace.visualstudio.com/items?itemName=HybridTalentComputing.cline-chinese" target="_blank"><strong>Im VS Marketplace herunterladen</strong></a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://discord.gg/cline" target="_blank"><strong>Discord</strong></a>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<table>
|
||||
<tbody>
|
||||
<td align="center">
|
||||
<a href="https://marketplace.visualstudio.com/items?itemName=shengsuan-cloud.cline-shengsuan" target="_blank"><strong>Descargar en VS Marketplace</strong></a>
|
||||
<a href="https://marketplace.visualstudio.com/items?itemName=HybridTalentComputing.cline-chinese" target="_blank"><strong>Descargar en VS Marketplace</strong></a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://discord.gg/cline" target="_blank"><strong>Discord</strong></a>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<table>
|
||||
<tbody>
|
||||
<td align="center">
|
||||
<a href="https://marketplace.visualstudio.com/items?itemName=shengsuan-cloud.cline-shengsuan" target="_blank"><strong>VS Marketplaceでダウンロード</strong></a>
|
||||
<a href="https://marketplace.visualstudio.com/items?itemName=HybridTalentComputing.cline-chinese" target="_blank"><strong>VS Marketplaceでダウンロード</strong></a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://discord.gg/cline" target="_blank"><strong>Discord</strong></a>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<table>
|
||||
<tbody>
|
||||
<td align="center">
|
||||
<a href="https://marketplace.visualstudio.com/items?itemName=shengsuan-cloud.cline-shengsuan" target="_blank"><strong>VS Marketplace에서 다운로드</strong></a>
|
||||
<a href="https://marketplace.visualstudio.com/items?itemName=HybridTalentComputing.cline-chinese" target="_blank"><strong>VS Marketplace에서 다운로드</strong></a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://discord.gg/cline" target="_blank"><strong>Discord</strong></a>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<table>
|
||||
<tbody>
|
||||
<td align="center">
|
||||
<a href="https://marketplace.visualstudio.com/items?itemName=shengsuan-cloud.cline-shengsuan" target="_blank"><strong>Baixar no VS Marketplace</strong></a>
|
||||
<a href="https://marketplace.visualstudio.com/items?itemName=HybridTalentComputing.cline-chinese" target="_blank"><strong>Baixar no VS Marketplace</strong></a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://discord.gg/cline" target="_blank"><strong>Discord</strong></a>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<table>
|
||||
<tbody>
|
||||
<td align="center">
|
||||
<a href="https://marketplace.visualstudio.com/items?itemName=shengsuan-cloud.cline-shengsuan" target="_blank"><strong>在 VS Marketplace 下载</strong></a>
|
||||
<a href="https://marketplace.visualstudio.com/items?itemName=HybridTalentComputing.cline-chinese" target="_blank"><strong>在 VS Marketplace 下载</strong></a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://discord.gg/cline" target="_blank"><strong>Discord</strong></a>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<table>
|
||||
<tbody>
|
||||
<td align="center">
|
||||
<a href="https://marketplace.visualstudio.com/items?itemName=shengsuan-cloud.cline-shengsuan" target="_blank"><strong>從 VS Marketplace 下載</strong></a>
|
||||
<a href="https://marketplace.visualstudio.com/items?itemName=HybridTalentComputing.cline-chinese" target="_blank"><strong>從 VS Marketplace 下載</strong></a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://discord.gg/cline" target="_blank"><strong>Discord</strong></a>
|
||||
|
||||
Generated
+2
-2
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "claude-dev",
|
||||
"name": "cline-chinese",
|
||||
"version": "3.46.5",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "claude-dev",
|
||||
"name": "cline-chinese",
|
||||
"version": "3.46.2",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
|
||||
+23
-14
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "claude-dev",
|
||||
"displayName": "Cline",
|
||||
"name": "cline-chinese",
|
||||
"displayName": "Cline Chinese",
|
||||
"description": "%cline.description%",
|
||||
"version": "3.46.5",
|
||||
"icon": "assets/icons/icon.png",
|
||||
@@ -8,15 +8,15 @@
|
||||
"vscode": "^1.84.0"
|
||||
},
|
||||
"author": {
|
||||
"name": "Cline Bot Inc."
|
||||
"name": "HybridTalentComputing"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"publisher": "saoudrizwan",
|
||||
"publisher": "HybridTalentComputing",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/cline/cline"
|
||||
"url": "https://github.com/HybridTalentComputing/cline-chinese"
|
||||
},
|
||||
"homepage": "https://cline.bot",
|
||||
"homepage": "https://github.com/HybridTalentComputing/cline-chinese",
|
||||
"categories": [
|
||||
"AI",
|
||||
"Chat",
|
||||
@@ -46,6 +46,15 @@
|
||||
],
|
||||
"main": "./dist/extension.js",
|
||||
"contributes": {
|
||||
"chatParticipants": [
|
||||
{
|
||||
"id": "claude-code",
|
||||
"name": "Claude Code",
|
||||
"description": "Chat with Claude Code",
|
||||
"isDefault": true,
|
||||
"icon": "assets/icons/icon.png"
|
||||
}
|
||||
],
|
||||
"icons": {
|
||||
"cline-icon": {
|
||||
"description": "cline",
|
||||
@@ -110,17 +119,17 @@
|
||||
"viewsContainers": {
|
||||
"activitybar": [
|
||||
{
|
||||
"id": "claude-dev-ActivityBar",
|
||||
"id": "cline-chinese-ActivityBar",
|
||||
"title": "Cline",
|
||||
"icon": "assets/icons/icon.svg"
|
||||
}
|
||||
]
|
||||
},
|
||||
"views": {
|
||||
"claude-dev-ActivityBar": [
|
||||
"cline-chinese-ActivityBar": [
|
||||
{
|
||||
"type": "webview",
|
||||
"id": "claude-dev.SidebarProvider",
|
||||
"id": "cline-chinese.SidebarProvider",
|
||||
"name": "",
|
||||
"icon": "assets/icons/icon.svg"
|
||||
}
|
||||
@@ -256,27 +265,27 @@
|
||||
{
|
||||
"command": "cline.plusButtonClicked",
|
||||
"group": "navigation@1",
|
||||
"when": "view == claude-dev.SidebarProvider"
|
||||
"when": "view == cline-chinese.SidebarProvider"
|
||||
},
|
||||
{
|
||||
"command": "cline.mcpButtonClicked",
|
||||
"group": "navigation@2",
|
||||
"when": "view == claude-dev.SidebarProvider"
|
||||
"when": "view == cline-chinese.SidebarProvider"
|
||||
},
|
||||
{
|
||||
"command": "cline.historyButtonClicked",
|
||||
"group": "navigation@3",
|
||||
"when": "view == claude-dev.SidebarProvider"
|
||||
"when": "view == cline-chinese.SidebarProvider"
|
||||
},
|
||||
{
|
||||
"command": "cline.accountButtonClicked",
|
||||
"group": "navigation@5",
|
||||
"when": "view == claude-dev.SidebarProvider"
|
||||
"when": "view == cline-chinese.SidebarProvider"
|
||||
},
|
||||
{
|
||||
"command": "cline.settingsButtonClicked",
|
||||
"group": "navigation@6",
|
||||
"when": "view == claude-dev.SidebarProvider"
|
||||
"when": "view == cline-chinese.SidebarProvider"
|
||||
}
|
||||
],
|
||||
"editor/context": [
|
||||
|
||||
@@ -65,6 +65,7 @@ message UserInfo {
|
||||
optional string email = 3;
|
||||
optional string photo_url = 4;
|
||||
optional string app_base_url = 5; // Cline app base URL
|
||||
optional double balance = 6;
|
||||
}
|
||||
|
||||
message UserOrganization {
|
||||
@@ -84,10 +85,11 @@ message UserOrganizationUpdateRequest {
|
||||
}
|
||||
|
||||
message UserCreditsData {
|
||||
UserCreditsBalance balance = 1;
|
||||
optional UserCreditsBalance balance = 1;
|
||||
repeated UsageTransaction usage_transactions = 2;
|
||||
repeated PaymentTransaction payment_transactions = 3;
|
||||
optional UserInfo user = 4;
|
||||
optional float rate = 5;
|
||||
}
|
||||
|
||||
message GetOrganizationCreditsRequest {
|
||||
|
||||
@@ -20,7 +20,7 @@ service EnvService {
|
||||
rpc getHostVersion(cline.EmptyRequest) returns (GetHostVersionResponse);
|
||||
|
||||
// Returns a URI that will redirect to the host environment.
|
||||
// e.g. vscode://saoudrizwan.claude-dev, idea://, pycharm://, etc.
|
||||
// e.g. vscode://saoudrizwan.cline-chinese, idea://, pycharm://, etc.
|
||||
// If the host does not support URIs it should return empty.
|
||||
rpc getIdeRedirectUri(cline.EmptyRequest) returns (cline.String);
|
||||
|
||||
|
||||
@@ -167,9 +167,11 @@ class NightlyPublisher {
|
||||
* Update package.json with nightly configuration
|
||||
*/
|
||||
updatePackageJson() {
|
||||
// Replace any occurrences cline. or claude-dev with nightly name
|
||||
// Replace any occurrences cline. or cline-chinese with nightly name
|
||||
const rawContent = fs.readFileSync(config.packageJsonPath, "utf-8")
|
||||
const content = rawContent.replaceAll("claude-dev", config.nightlyName).replaceAll('"cline.', `"${config.nightlyName}.`)
|
||||
const content = rawContent
|
||||
.replaceAll("cline-chinese", config.nightlyName)
|
||||
.replaceAll('"cline.', `"${config.nightlyName}.`)
|
||||
|
||||
const pkg = JSON.parse(content)
|
||||
const currentVersion = pkg.version
|
||||
|
||||
@@ -12,7 +12,7 @@ const ask = (question) => new Promise((resolve) => rl.question(`\n${question}`,
|
||||
const getClineVersion = () => {
|
||||
try {
|
||||
const extensions = execSync("code --list-extensions --show-versions").toString()
|
||||
const clineMatch = extensions.match(/claude-dev@(\d+\.\d+\.\d+)/)
|
||||
const clineMatch = extensions.match(/cline-chinese@(\d+\.\d+\.\d+)/)
|
||||
return clineMatch ? clineMatch[1] : "Not installed"
|
||||
} catch (_err) {
|
||||
return "Error getting version"
|
||||
|
||||
@@ -42,7 +42,7 @@ export class ShengSuanYunHandler implements ApiHandler {
|
||||
baseURL: "https://router.shengsuanyun.com/api/v1",
|
||||
apiKey: this.options.shengSuanYunApiKey,
|
||||
defaultHeaders: {
|
||||
"HTTP-Referer": `vscode://shengsuan-cloud.cline-shengsuan/ssy`,
|
||||
"HTTP-Referer": `vscode://HybridTalentComputing.cline-chinese/ssy`,
|
||||
"X-Title": "cline",
|
||||
},
|
||||
})
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
import { EmptyRequest, String } from "@shared/proto/cline/common"
|
||||
// import vscode from "vscode"
|
||||
import { HostProvider } from "@/hosts/host-provider"
|
||||
import { openExternal } from "@/utils/env"
|
||||
import { Controller } from ".."
|
||||
|
||||
export async function shengSuanYunLoginClicked(_controller: Controller, _: EmptyRequest): Promise<String> {
|
||||
const id = "cline-shengsuan"
|
||||
const channel = "CH_R39YE8W1"
|
||||
const author = "shengsuan-cloud"
|
||||
const authUrl = new URL(
|
||||
`https://router.shengsuanyun.com/auth?from=${channel}&callback_url=${encodeURIComponent(`vscode://${author}.${id}/ssy`)}`,
|
||||
)
|
||||
export async function shengSuanYunLoginClicked(controller: Controller, _: EmptyRequest): Promise<String> {
|
||||
const callbackHost = await HostProvider.get().getCallbackUrl()
|
||||
const callbackUrl = `${callbackHost}/ssy`
|
||||
const id = "cline-chinese"
|
||||
const authUrl = new URL(`https://router.shengsuanyun.com/auth?from=${id}&callback_url=${callbackUrl}`)
|
||||
const authUrlString = authUrl.toString()
|
||||
await openExternal(authUrlString)
|
||||
return String.create({ value: authUrlString })
|
||||
|
||||
@@ -688,7 +688,6 @@ export class Controller {
|
||||
}
|
||||
|
||||
// OpenRouter
|
||||
|
||||
async handleOpenRouterCallback(code: string) {
|
||||
let apiKey: string
|
||||
try {
|
||||
@@ -725,13 +724,12 @@ export class Controller {
|
||||
|
||||
// shengsuanyun Auth
|
||||
async handleShengSuanYunCallback(code: string) {
|
||||
// console.log("handleShengSuanYunCallback() with code:", code)
|
||||
try {
|
||||
let shengSuanYunApiKey: string
|
||||
let shengSuanYunToken: string
|
||||
const res = await axios.post("https://api.shengsuanyun.com/auth/keys", {
|
||||
code: code,
|
||||
callback_url: `vscode://shengsuan-cloud.cline-shengsuan/ssy`,
|
||||
callback_url: `vscode://HybridTalentComputing.cline-chinese/ssy`,
|
||||
})
|
||||
// console.log("https://api.shengsuanyun.com/auth/keys :", res.data)
|
||||
if (res.data && res.data.data && res.data.data.api_key) {
|
||||
@@ -758,8 +756,8 @@ export class Controller {
|
||||
if (this.task) {
|
||||
this.task.api = buildApiHandler({ ...updatedConfig, ulid: this.task.ulid }, currentMode)
|
||||
}
|
||||
const user: UserInfo = await this.accountServiceSSY.getUserInfo()
|
||||
// console.log("Controller.fetchUserCreditsData().user", user)
|
||||
const user: UserInfo = await this.accountServiceSSY.getUserInfo(shengSuanYunToken)
|
||||
console.log("Controller.fetchUserCreditsData().user ------------", user)
|
||||
this.stateManager.setGlobalState("userInfo", user)
|
||||
await this.postStateToWebview()
|
||||
} catch (error) {
|
||||
|
||||
@@ -15,7 +15,7 @@ export async function openWalkthrough(_controller: Controller, _request: EmptyRe
|
||||
try {
|
||||
await vscode.commands.executeCommand(
|
||||
"workbench.action.openWalkthrough",
|
||||
`shengsuan-cloud.${ExtensionRegistryInfo.name}#ClineWalkthrough`,
|
||||
`HybridTalentComputing.${ExtensionRegistryInfo.name}#ClineWalkthrough`,
|
||||
)
|
||||
// telemetryService.captureButtonClick("webview_openWalkthrough")
|
||||
return Empty.create({})
|
||||
|
||||
@@ -7,7 +7,7 @@ The Cline extension exposes an API that can be used by other extensions. To use
|
||||
3. Get access to the API with the following code:
|
||||
|
||||
```ts
|
||||
const clineExtension = vscode.extensions.getExtension<ClineAPI>("shengsuan-cloud.cline-shengsuan")
|
||||
const clineExtension = vscode.extensions.getExtension<ClineAPI>("HybridTalentComputing.cline-chinese")
|
||||
|
||||
if (!clineExtension?.isActive) {
|
||||
throw new Error("Cline extension is not activated")
|
||||
@@ -37,11 +37,11 @@ The Cline extension exposes an API that can be used by other extensions. To use
|
||||
}
|
||||
```
|
||||
|
||||
**Note:** To ensure that the `shengsuan-cloud.cline-shengsuan` extension is activated before your extension, add it to the `extensionDependencies` in your `package.json`:
|
||||
**Note:** To ensure that the `HybridTalentComputing.cline-chinese` extension is activated before your extension, add it to the `extensionDependencies` in your `package.json`:
|
||||
|
||||
```json
|
||||
"extensionDependencies": [
|
||||
"shengsuan-cloud.cline-shengsuan"
|
||||
"HybridTalentComputing.cline-chinese"
|
||||
]
|
||||
```
|
||||
|
||||
|
||||
+1
-1
@@ -3,6 +3,6 @@ import * as vscode from "vscode"
|
||||
|
||||
export async function getIdeRedirectUri(_: EmptyRequest): Promise<String> {
|
||||
const uriScheme = vscode.env.uriScheme || "vscode"
|
||||
const url = `${uriScheme}://saoudrizwan.claude-dev`
|
||||
const url = `${uriScheme}://saoudrizwan.cline-chinese`
|
||||
return { value: url }
|
||||
}
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
import { name, publisher, version } from "../package.json"
|
||||
|
||||
const prefix = name === "claude-dev" ? "cline" : "cline"
|
||||
const prefix = "cline"
|
||||
|
||||
/**
|
||||
* List of commands with the name of the extension they are registered under.
|
||||
@@ -31,7 +31,7 @@ const ClineCommands = {
|
||||
* These should match the name + view IDs defined in package.json.
|
||||
*/
|
||||
const ClineViewIds = {
|
||||
Sidebar: "claude-dev.SidebarProvider",
|
||||
Sidebar: "cline-chinese.SidebarProvider",
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,16 +10,18 @@ export class SSYAccountService {
|
||||
}
|
||||
private async authenticatedRequest<T>(endpoint: string, config: AxiosRequestConfig = {}): Promise<T> {
|
||||
const ssyApiKey = await this.getSSYApiKey()
|
||||
if (!ssyApiKey) {
|
||||
throw new Error("未找到胜算云 Auth API")
|
||||
const hasToken = config?.headers?.["x-token"]
|
||||
if (!ssyApiKey && !hasToken) {
|
||||
throw new Error("未找到胜算云 Auth API Key")
|
||||
}
|
||||
const reqConfig: AxiosRequestConfig = {
|
||||
...config,
|
||||
headers: {
|
||||
"x-token": ssyApiKey,
|
||||
"Content-Type": "application/json",
|
||||
...config.headers,
|
||||
"x-token": ssyApiKey || hasToken,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
timeout: 50000,
|
||||
}
|
||||
const url = `${this.baseUrl}${endpoint}`
|
||||
// console.log("SSYAccountService.authenticatedRequest():", url, reqConfig)
|
||||
@@ -34,13 +36,12 @@ export class SSYAccountService {
|
||||
async fetchUserDataRPC(): Promise<UserCreditsData> {
|
||||
try {
|
||||
const dqs = this.dateQueryString()
|
||||
let [rate, usage, payment, user] = await Promise.all([
|
||||
let [rate, usage, payment] = await Promise.all([
|
||||
this.authenticatedRequest<any>("/base/rate"),
|
||||
this.authenticatedRequest<any>(`/modelrouter/userlog?page=1&pageSize=1000&${dqs}`),
|
||||
this.authenticatedRequest<any>("/modelrouter/listrecharge?page=1&pageSize=10000"),
|
||||
this.authenticatedRequest<any>("/user/info"),
|
||||
])
|
||||
if (!rate || !user) {
|
||||
if (!rate) {
|
||||
throw new Error(`获取胜算云账户信息失败!`)
|
||||
}
|
||||
if (!usage || !Array.isArray(usage?.logs)) {
|
||||
@@ -66,22 +67,11 @@ export class SSYAccountService {
|
||||
credits: 0,
|
||||
}))
|
||||
}
|
||||
|
||||
let balance = { currentBalance: 0 }
|
||||
if (user.Wallet && user.Wallet.Assets) {
|
||||
balance = { currentBalance: (rate * user.Wallet.Assets) / 10000 }
|
||||
}
|
||||
console.log("UserCreditsData", balance, usage, payment, user)
|
||||
console.log("UserCreditsData", usage, payment)
|
||||
return UserCreditsData.create({
|
||||
balance: balance,
|
||||
rate: rate,
|
||||
usageTransactions: usage,
|
||||
paymentTransactions: payment,
|
||||
user: {
|
||||
uid: user.ID,
|
||||
displayName: user.Nickname || user.Username || user.Phone,
|
||||
email: user.Email,
|
||||
photoUrl: user.HeadImg,
|
||||
},
|
||||
})
|
||||
} catch (error) {
|
||||
console.error("Failed fetchUserDataRPC:", error)
|
||||
@@ -89,21 +79,25 @@ export class SSYAccountService {
|
||||
}
|
||||
}
|
||||
|
||||
async getUserInfo(): Promise<UserInfo> {
|
||||
async getUserInfo(token: string = ""): Promise<UserInfo> {
|
||||
const headers = { ...(token ? { "x-token": token } : {}) }
|
||||
try {
|
||||
const res = await this.authenticatedRequest<any>("/user/info")
|
||||
if (!res.data || !res.data.data || res.data.code !== 0) {
|
||||
const res = await this.authenticatedRequest<any>("/user/info", { headers })
|
||||
if (!res) {
|
||||
console.log(res)
|
||||
throw new Error(`Invalid response from API: /user/info`)
|
||||
}
|
||||
const user: UserInfo = {
|
||||
displayName: res.data.data.Nickname || res.data.data.Username || undefined,
|
||||
email: res.data.data.Email ?? undefined,
|
||||
photoUrl: res.data.data.HeadImg ?? undefined,
|
||||
uid: res.data.data.ID || undefined,
|
||||
displayName: res.Nickname || res.Username || undefined,
|
||||
email: res.Email ?? undefined,
|
||||
photoUrl: res.HeadImg ?? undefined,
|
||||
uid: res.ID || undefined,
|
||||
balance: res.Wallet.Assets / 10000,
|
||||
}
|
||||
return user
|
||||
} catch (error) {
|
||||
console.error("getUserInfo():", error)
|
||||
console.log("headers: ", headers)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,4 +3,5 @@ export interface UserInfo {
|
||||
email?: string
|
||||
photoUrl?: string
|
||||
apiBaseUrl?: string // Base URL for API requests
|
||||
balance?: number
|
||||
}
|
||||
@@ -25,7 +25,7 @@ describe("Extension Tests", function () {
|
||||
|
||||
it("should activate extension successfully", async () => {
|
||||
// Get the extension
|
||||
const extension = vscode.extensions.getExtension("shengsuan-cloud.cline-shengsuan")
|
||||
const extension = vscode.extensions.getExtension("HybridTalentComputing.cline-chinese")
|
||||
expect(extension).to.not.be.undefined
|
||||
|
||||
// Activate the extension if not already activated
|
||||
|
||||
@@ -59,9 +59,9 @@ const CreditsHistoryTable = memo(({ isLoading, usageData, paymentsData, showPaym
|
||||
</VSCodeDataGridCell>
|
||||
<VSCodeDataGridCell grid-column="2">{`${row.model}`}</VSCodeDataGridCell>
|
||||
<VSCodeDataGridCell grid-column="3">
|
||||
{Number(row.credits).toFixed(4)}
|
||||
{Number(row.credits).toFixed(5)}
|
||||
</VSCodeDataGridCell>
|
||||
<VSCodeDataGridCell grid-column="2">
|
||||
{/* <VSCodeDataGridCell grid-column="2">
|
||||
{row.operation === "web_search"
|
||||
? t("account.creditsHistory.webSearch")
|
||||
: row.operation === "web_fetch"
|
||||
@@ -69,9 +69,9 @@ const CreditsHistoryTable = memo(({ isLoading, usageData, paymentsData, showPaym
|
||||
: row.operation === "search_chat_completion"
|
||||
? t("account.creditsHistory.webFetchLlm")
|
||||
: row.aiModelName}
|
||||
</VSCodeDataGridCell>
|
||||
</VSCodeDataGridCell> */}
|
||||
{/* <VSCodeDataGridCell grid-column="3">{`${row.promptTokens} → ${row.completionTokens}`}</VSCodeDataGridCell> */}
|
||||
<VSCodeDataGridCell grid-column="3">{`$${Number(row.creditsUsed / 1000000).toFixed(4)}`}</VSCodeDataGridCell>
|
||||
{/* <VSCodeDataGridCell grid-column="3">{`$${Number(row.credits).toFixed(4)}`}</VSCodeDataGridCell> */}
|
||||
</VSCodeDataGridRow>
|
||||
))}
|
||||
</VSCodeDataGrid>
|
||||
|
||||
@@ -10,30 +10,31 @@ import CreditsHistoryTable from "./CreditsHistoryTable"
|
||||
import { StyledCreditDisplaySSY } from "./StyledCreditDisplaySSY"
|
||||
|
||||
export const SSYAccountView = () => {
|
||||
const { userInfo, setUserInfo } = useExtensionState()
|
||||
const { userInfo } = useExtensionState()
|
||||
console.log("SSYAccountView() userInfo: ", userInfo)
|
||||
|
||||
const [balance, setBalance] = useState(0)
|
||||
const [rate, setRate] = useState(0)
|
||||
const [isLoading, setIsLoading] = useState(true)
|
||||
const [usageData, setUsageData] = useState<UsageTransaction[]>([])
|
||||
const [paymentsData, setPaymentsData] = useState<PaymentTransaction[]>([])
|
||||
|
||||
// Fetch all account data when component mounts using gRPC
|
||||
useEffect(() => {
|
||||
if (!userInfo || !userInfo.displayName) {
|
||||
return
|
||||
}
|
||||
setIsLoading(true)
|
||||
AccountServiceClient.shengSuanYunUserData(EmptyRequest.create())
|
||||
.then((res: any) => {
|
||||
setBalance(res.balance?.currentBalance || 0)
|
||||
setRate(res.rate || 0)
|
||||
setUsageData(res.usageTransactions)
|
||||
setPaymentsData(res.paymentTransactions)
|
||||
setUserInfo(res.user)
|
||||
})
|
||||
.catch((error: any) => {
|
||||
console.error("Failed to fetch user credits data:", error)
|
||||
setUserInfo(undefined)
|
||||
})
|
||||
.finally(() => setIsLoading(false))
|
||||
}, [])
|
||||
}, [userInfo])
|
||||
|
||||
return (
|
||||
<div className="h-full flex flex-col">
|
||||
@@ -95,7 +96,7 @@ export const SSYAccountView = () => {
|
||||
) : (
|
||||
<>
|
||||
<span>$</span>
|
||||
<StyledCreditDisplaySSY balance={balance} />
|
||||
<StyledCreditDisplaySSY balance={(userInfo.balance || 0) * rate} />
|
||||
<VSCodeButton
|
||||
appearance="icon"
|
||||
className="mt-1"
|
||||
@@ -103,7 +104,7 @@ export const SSYAccountView = () => {
|
||||
setIsLoading(true)
|
||||
AccountServiceClient.shengSuanYunUserData(EmptyRequest.create())
|
||||
.then((res) => {
|
||||
setBalance(res.balance?.currentBalance || 0)
|
||||
setRate(res.rate || 0)
|
||||
setUsageData(res.usageTransactions as any)
|
||||
setPaymentsData(res.paymentTransactions)
|
||||
})
|
||||
@@ -137,11 +138,15 @@ export const SSYAccountView = () => {
|
||||
<p style={{}}>注册帐户访问最新模型,进群联系客服,获得100万Tokens免费额度,以及更多即将推出的功能。</p>
|
||||
<VSCodeButton
|
||||
className="w-full mb-4"
|
||||
onClick={() =>
|
||||
AccountServiceClient.shengSuanYunLoginClicked(EmptyRequest.create()).catch((err) =>
|
||||
console.error("Failed to get login URL:", err),
|
||||
)
|
||||
}>
|
||||
disabled={isLoading}
|
||||
onClick={() => {
|
||||
setIsLoading(true)
|
||||
AccountServiceClient.shengSuanYunLoginClicked(EmptyRequest.create())
|
||||
.catch((err) => console.error("Failed to get login URL:", err))
|
||||
.finally(() => {
|
||||
setIsLoading(false)
|
||||
})
|
||||
}}>
|
||||
注册 Cline 胜算云
|
||||
</VSCodeButton>
|
||||
<p className="text-[var(--vscode-descriptionForeground)] text-xs text-center m-0">
|
||||
|
||||
@@ -19,7 +19,7 @@ const CreditLimitErrorSSY: React.FC<CreditLimitErrorSSYProps> = ({
|
||||
buyCreditsUrl = "https://console.shengsuanyun.com/user/recharge",
|
||||
}) => {
|
||||
const { uriScheme } = useExtensionState()
|
||||
const callbackUrl = `${uriScheme || "vscode"}://shengsuan-cloud.cline-shengsuan`
|
||||
const callbackUrl = `${uriScheme || "vscode"}://HybridTalentComputing.cline-chinese`
|
||||
const fullPurchaseUrl = new URL(buyCreditsUrl)
|
||||
fullPurchaseUrl.searchParams.set("callback_url", callbackUrl)
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ export const WhatsNewModal: React.FC<WhatsNewModalProps> = ({ open, onClose, ver
|
||||
<div className="flex gap-2 flex-wrap">{children}</div>
|
||||
) : (
|
||||
<Button className="my-1" onClick={handleShowAccount} size="sm">
|
||||
注册 Cline 中文版
|
||||
胜算云中使用
|
||||
</Button>
|
||||
)
|
||||
|
||||
|
||||
@@ -1,115 +1,6 @@
|
||||
import { AuthStateChangedRequest } from "@shared/proto/cline/account"
|
||||
import { EmptyRequest } from "@shared/proto/cline/common"
|
||||
import axios, { AxiosRequestConfig } from "axios"
|
||||
import React, { createContext, useCallback, useContext, useEffect, useState } from "react"
|
||||
import { useCallback, useState } from "react"
|
||||
import { AccountServiceClient } from "@/services/grpc-client"
|
||||
import { useExtensionState } from "./ExtensionStateContext"
|
||||
|
||||
interface ShengSuanYunAuthContextType {
|
||||
userSSY: any | null
|
||||
isInitSSY: boolean
|
||||
signInWithTokenSSY: (token: string) => Promise<void>
|
||||
handleSignOutSSY: () => Promise<void>
|
||||
}
|
||||
|
||||
const ShengSuanYunAuthContext = createContext<ShengSuanYunAuthContextType | undefined>(undefined)
|
||||
export const ShengSuanYunAuthProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {
|
||||
const [userSSY, setUser] = useState<any | null>(null)
|
||||
const [isInitSSY, setIsInitialized] = useState(false)
|
||||
const { apiConfiguration, setUserInfo } = useExtensionState()
|
||||
|
||||
useEffect(() => {
|
||||
if (apiConfiguration?.shengSuanYunToken) {
|
||||
signInWithTokenSSY(apiConfiguration?.shengSuanYunToken)
|
||||
}
|
||||
}, [apiConfiguration?.shengSuanYunToken])
|
||||
|
||||
const signInWithTokenSSY = async (token: string) => {
|
||||
try {
|
||||
const reqConfig: AxiosRequestConfig = {
|
||||
headers: {
|
||||
"x-token": token,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
}
|
||||
const uri = "https://api.shengsuanyun.com/user/info"
|
||||
const res = await axios.get(uri, reqConfig)
|
||||
if (!res.data || !res.data.data || res.data.code !== 0) {
|
||||
throw new Error(`Invalid response from ${uri} API`)
|
||||
}
|
||||
const user: any = {
|
||||
displayName: res.data.data.Nickname || res.data.data.Username || undefined,
|
||||
email: res.data.data.Email ?? undefined,
|
||||
photoURL: res.data.data.HeadImg ?? undefined,
|
||||
uid: res.data.data.ID || undefined,
|
||||
}
|
||||
setUser(user)
|
||||
setIsInitialized(true)
|
||||
AccountServiceClient.authStateChanged(AuthStateChangedRequest.create({ user }))
|
||||
.then((res) => {
|
||||
setUserInfo(res.user)
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("Error updating auth state via gRPC:", error)
|
||||
})
|
||||
} catch (error) {
|
||||
console.error("signInWithTokenSSY():", error)
|
||||
console.log("signInWithTokenSSY(token):", token)
|
||||
// throw error
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const cleanup = AccountServiceClient.subscribeSsyAuthCallback(EmptyRequest.create({}), {
|
||||
onResponse: (event) => {
|
||||
if (event.value) {
|
||||
signInWithTokenSSY(event.value)
|
||||
}
|
||||
},
|
||||
onError: (error) => {
|
||||
console.error("Error in signInWithTokenSSY subscription:", error)
|
||||
},
|
||||
onComplete: () => {},
|
||||
})
|
||||
return cleanup
|
||||
}, [signInWithTokenSSY])
|
||||
|
||||
const handleSignOutSSY = useCallback(async () => {
|
||||
try {
|
||||
AccountServiceClient.shengSuanYunLogoutClicked(EmptyRequest.create()).catch((err) =>
|
||||
console.error("shengSuanYunLogoutClicked Failed to logout:", err),
|
||||
)
|
||||
console.log("Successfully signed out of ssy")
|
||||
} catch (error) {
|
||||
console.error("Error signing out of ssy:", error)
|
||||
throw error
|
||||
}
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<ShengSuanYunAuthContext.Provider value={{ userSSY, isInitSSY, signInWithTokenSSY, handleSignOutSSY }}>
|
||||
{children}
|
||||
</ShengSuanYunAuthContext.Provider>
|
||||
)
|
||||
}
|
||||
|
||||
export const handleSignInSSY = async () => {
|
||||
try {
|
||||
AccountServiceClient.shengSuanYunLoginClicked(EmptyRequest.create()).catch((err) =>
|
||||
console.error("Failed to get login URL:", err),
|
||||
)
|
||||
} catch (error) {
|
||||
console.error("Error signing in:", error)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
export const useShengSuanYunAuth = () => {
|
||||
const context = useContext(ShengSuanYunAuthContext)
|
||||
if (context === undefined) {
|
||||
throw new Error("useShengSuanYunAuth must be used within a ShengSuanYunAuthProvider")
|
||||
}
|
||||
return context
|
||||
}
|
||||
|
||||
export const useSignIn = () => {
|
||||
const [isLoading, setIsLoading] = useState(false)
|
||||
|
||||
Reference in new issue
Block a user