Clean up project: Remove unused files and update README

This commit is contained in:
李东云
2025-02-10 19:02:57 +08:00
parent 50ab2cf69c
commit 5900791890
10 changed files with 62 additions and 136 deletions

View File

@@ -1,13 +0,0 @@
# 总结
**核心观点:**
* **指数层面:** 虽然今天收小阳线但存在隐患主要问题是成交量大幅萎缩即便突破3322点60日线问题可能更大。下午的上攻伴随量能萎缩呈现量价背离需要警惕。
* **操作建议:** 如果明天高开个股出现进攻衰竭信号,可适当减仓,以防量能持续萎缩导致市场降温。但由于今天只是第一天量价不匹配,若未来量能能再次放大,则个股仍有操作空间。
* **仓位:** 个人维持5-5.5成仓位,消费和医药持仓为主,不考虑加仓。目前位置不适合中线布局,除非是长线布局。
* **DS题材可能指数字经济或算力概念** 目前已进入深度博傻阶段等待接盘侠。三大运营商电信、联通必须持续冲新高否则可能面临负反馈。资金不会立刻撤出DS仍会在科技股中流动直到更大的利好出现。
* **风险提示:** 不建议追高DS题材现在入场已经太晚如果要参与只能小仓位短线投机并设置止损。不要盲目相信科技信仰避免高位接盘。
**总结:**
作者认为当前市场存在量价背离的隐患建议谨慎操作注意控制仓位。对于近期火热的DS题材作者持谨慎态度认为已进入博傻阶段不建议追高。

View File

@@ -1,15 +1,67 @@
# info_flow # info_flow
To install dependencies: 一个用于总结微信文章并生成投资策略的项目。
## **功能:**
* 抓取微信文章内容
* 利用 Gemini API 总结文章
* 根据文章内容生成短、中、长线投资策略 (如果文章是投资主题)
* 将总结和投资策略保存到 Markdown 文件
## **技术栈:**
* [Bun](https://bun.sh):快速的 all-in-one JavaScript 运行时
* [Elysia.js](https://elysiajs.com/)Web 框架
* [Google Gemini API](https://ai.google.dev/):用于生成文本
* [JSDOM](https://github.com/jsdom/jsdom):在 Node.js 中模拟 DOM 环境
* [Cheerio](https://github.com/cheeriojs/cheerio):快速灵活的 HTML 解析器
## **安装依赖:**
```bash ```bash
bun install bun install
``` ```
To run: ## **运行项目:**
```bash ```bash
bun run index.js bun run index.ts
``` ```
This project was created using `bun init` in bun v1.1.37. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime. ## **构建项目:**
```bash
bun build index.ts --outfile=dist/lockon --compile
```
## **运行构建后的项目:**
```bash
dist/lockon
```
## **项目结构:**
* `index.ts`Elysia.js 应用入口,包含路由和主要逻辑 (typescript:index.ts)
* `package.json`:项目依赖和脚本 (json:package.json)
* `jsconfig.json`TypeScript 配置文件 (json:jsconfig.json)
* `.gitignore`Git 忽略文件 (.gitignore)
* `global.d.ts`:全局类型声明 (typescript:global.d.ts)
* `history/`:存放历史总结和投资策略的目录
* `README.md`:项目介绍 (markdown:README.md)
## **环境变量:**
* `API_KEY`Google Gemini API 的 API 密钥
## **使用方法:**
1. 在根目录下创建 `.env` 文件,并添加 `API_KEY=YOUR_API_KEY`
2. 运行项目:`bun run index.js`
3. 在浏览器中打开 `http://localhost:3000`,输入微信文章链接,点击提交。
4. 总结和投资策略将保存在 `history/` 目录下,并显示在浏览器中。
## **贡献:**
欢迎提交 issue 和 pull request

View File

@@ -1,15 +0,0 @@
// ai.js
export async function analyzeContent(content) {
// 假设DeepSeek API的调用方式
const response = await fetch("https://api.deepseek.com/v1/analyze", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer sk-75972dd6431e4440a0428fa8922ed6b1",
},
body: JSON.stringify({ content }),
});
const result = await response.json();
console.log('Result:', result);
return result.summary; // 假设返回的是Markdown格式的总结
}

View File

@@ -1,21 +0,0 @@
// ... existing code ...
export async function fetchRSS(url, maxRetries = 3) {
let retries = 0;
while (retries < maxRetries) {
try {
const response = await fetch(url, { verbose: true, keepalive: true, timeout: 10000, compress: false });
// console.log('Response:', response);
const text = await response.text();
// console.log('Response Text:', text);
return text;
} catch (error) {
console.error(`Fetch Error (Attempt ${retries + 1}):`, error);
retries++;
// 等待一段时间再重试,避免过于频繁的请求
await new Promise(resolve => setTimeout(resolve, 1000));
}
}
console.error('Fetch failed after multiple retries.');
return null;
}
// ... existing code ...

View File

@@ -1,29 +0,0 @@
// server.js
import { serve } from "bun";
import { fetchRSS } from "./rss.js";
import { analyzeContent } from "./ai.js";
import { getWeChatArticleLinks } from "./wechat.js";
const PORT = 3000;
async function handleRequest(request) {
// 从环境变量中获取 RSS URL如果没有则使用默认值
const rssUrl = "https://mp.weixin.qq.com/s/vQgsMuxXffpFZkNFj89wUQ";
try {
const rssContent = await fetchRSS(rssUrl);
const analyzedContent = await analyzeContent(rssContent);
return new Response(analyzedContent, {
headers: { "Content-Type": "text/markdown" },
});
} catch (error) {
console.error("Error processing request:", error);
return new Response("Error processing request", { status: 500 });
}
}
serve({
port: PORT,
fetch: handleRequest,
});
console.log(`Server running at http://localhost:${PORT}`);

View File

@@ -1,24 +0,0 @@
import { JSDOM } from 'jsdom';
async function getWeChatArticleLinks(publicAccountName) {
// const searchUrl = `https://weixin.sogou.com/weixin?p=01030402&query=${encodeURIComponent(publicAccountName)}&type=2&ie=utf8`;
// const response = await fetch(searchUrl);
console.log(`https://mp.weixin.qq.com/mp/profile_ext?action=getmsg&__biz=${publicAccountName}`);
const response = await fetch(`https://mp.weixin.qq.com/mp/profile_ext?action=getmsg&__biz=${publicAccountName}`, {
headers: {
'Referer': `https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=${publicAccountName}`
}
});
const html = await response.text();
const { document } = new JSDOM(html).window;
const articleLinks = [];
const articleElements = document.querySelectorAll('.news-box .news-list li a');
articleElements.forEach((element) => {
const link = element.href;
articleLinks.push(link);
});
return articleLinks;
}
export { getWeChatArticleLinks };

View File

View File

@@ -7,14 +7,17 @@
"peerDependencies": { "peerDependencies": {
"typescript": "^5.0.0" "typescript": "^5.0.0"
}, },
"scripts": {
"start": "bun run dev",
"build": "bun build index.ts --outfile=dist/lockon --compile",
"dev": "bun run index.ts --watch"
},
"type": "module", "type": "module",
"dependencies": { "dependencies": {
"@elysiajs/html": "^1.2.0", "@elysiajs/html": "^1.2.0",
"@google/generative-ai": "^0.21.0", "@google/generative-ai": "^0.21.0",
"cheerio": "^1.0.0",
"dotenv": "^16.4.7", "dotenv": "^16.4.7",
"elysia": "^1.2.12", "elysia": "^1.2.12",
"jsdom": "^26.0.0", "jsdom": "^26.0.0"
"openai": "^4.83.0"
} }
} }

View File

@@ -1,11 +0,0 @@
/* style.css */
body {
max-width: 768px;
margin: 0 auto;
font-family: system-ui;
line-height: 1.6;
}
.timestamp {
color: #666;
font-size: 0.8em
}

View File

@@ -1,16 +0,0 @@
import { JSDOM } from 'jsdom';
async function getWeChatArticleLinks(publicAccountName) {
const html = await response.text();
const { document } = new JSDOM(html).window;
const articleLinks = [];
const articleElements = document.querySelectorAll('.news-box .news-list li a');
articleElements.forEach((element) => {
const link = element.href;
articleLinks.push(link);
});
return articleLinks;
}
export { getWeChatArticleLinks };