Skip to content

Commit 69a7058

Browse files
authored
Merge pull request #129 from cnblogs/update-parameters
feat: update parameters
2 parents 98e901b + f41e591 commit 69a7058

File tree

98 files changed

+6369
-673
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+6369
-673
lines changed

README.md

Lines changed: 406 additions & 74 deletions
Large diffs are not rendered by default.

README.zh-Hans.md

Lines changed: 2191 additions & 99 deletions
Large diffs are not rendered by default.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
中国程序员节,10月24日,你同意吗?
2+
大家好!
3+
4+
国庆长假之后,我们来确定一下中国程序员节的日子吧。
5+
6+
9月份的时候,我们针对中国程序员节进行了讨论与投票。
7+
8+
起因是一条新闻“今天是程序员节”,俄罗斯把每年的第256(0x100th)天作为程序员节,通常是9月12日,也有可能是9月13日。
9+
10+
园友贤达在评论中说:
11+
12+
想想这么多年中国程序员这么辛苦,怎么就没有个法定的程序员节日呢?
13+
可执行文件的代码只有0和1,希望有一个10.10为中国程序员节。
14+
于是,很多朋友支持把10月10日作为中国程序员节。
15+
16+
但10月10日紧接着中秋节与国庆节之后,大家正在恢复调整进入工作状态之中。
17+
18+
所以我们觉得10月24日可能更合适(今年的10月24日是星期天),1024是很有意义的一个数字,1K=1024,1024=2的10次方,二进制10000000000,八进制2000,十六进制0x400。
19+
20+
所以在这里征询一下大家意见,如果你同意10月24日作为中国程序员节,请点击随笔下面的推荐按钮,如果不同意,请点击反对按钮。
21+
22+
如果确定了中国程序员节,我们会在那天组织网上的庆贺活动。如果大家对活动形式有好的建议,也欢迎在这里提出。
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
程序员节,10月24日!
2+
根据大家在“中国程序员节,10月24日,你同意吗”中的反馈,现在确定中国程序员节放在每年的10月24日。博客园将在10月24日那天组织网上庆祝活动。
3+
4+
希望通过程序员节,代表着我们的一种努力,努力将程序员们凝聚在一起,为社会创造更多价值,得到更多的认可。我们是程序员,不是代码工人,不是IT民工,是一群用代码改变世界的人。我们的代码可以给社会带来进步,也可能给社会带来灾难,我们的责任重于泰山;我们生活于现实世界,却在创造虚拟世界,我们的创造力无限...如果阿基米德是程序员,他会说“给我一台电脑,我就能改变世界”。

sample/Cnblogs.DashScope.Sample/Cnblogs.DashScope.Sample.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@
2020
<None Update="Lenna.jpg">
2121
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
2222
</None>
23+
<None Update="1024-1.txt">
24+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
25+
</None>
26+
<None Update="1024-2.txt">
27+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
28+
</None>
2329
</ItemGroup>
2430

2531
<ItemGroup>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using Cnblogs.DashScope.Core;
2+
3+
namespace Cnblogs.DashScope.Sample;
4+
5+
public interface ISample
6+
{
7+
string Description { get; }
8+
Task RunAsync(IDashScopeClient client);
9+
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
using System.Text;
2+
using Cnblogs.DashScope.Core;
3+
4+
namespace Cnblogs.DashScope.Sample.Multimodal;
5+
6+
public class ImageInputSample : ISample
7+
{
8+
/// <inheritdoc />
9+
public string Description => "Chat with image input";
10+
11+
/// <inheritdoc />
12+
public async Task RunAsync(IDashScopeClient client)
13+
{
14+
var messages = new List<MultimodalMessage>();
15+
messages.Add(
16+
MultimodalMessage.User(
17+
[
18+
MultimodalMessageContent.ImageContent(
19+
"https://help-static-aliyun-doc.aliyuncs.com/file-manage-files/zh-CN/20241022/emyrja/dog_and_girl.jpeg"),
20+
MultimodalMessageContent.ImageContent("https://dashscope.oss-cn-beijing.aliyuncs.com/images/tiger.png"),
21+
MultimodalMessageContent.TextContent("这些图展现了什么内容?")
22+
]));
23+
var completion = client.GetMultimodalGenerationStreamAsync(
24+
new ModelRequest<MultimodalInput, IMultimodalParameters>()
25+
{
26+
Model = "qwen3-vl-plus",
27+
Input = new MultimodalInput() { Messages = messages },
28+
Parameters = new MultimodalParameters()
29+
{
30+
IncrementalOutput = true,
31+
EnableThinking = true,
32+
VlHighResolutionImages = true
33+
}
34+
});
35+
var reply = new StringBuilder();
36+
var reasoning = false;
37+
MultimodalTokenUsage? usage = null;
38+
await foreach (var chunk in completion)
39+
{
40+
var choice = chunk.Output.Choices[0];
41+
if (string.IsNullOrEmpty(choice.Message.ReasoningContent) == false)
42+
{
43+
// reasoning
44+
if (reasoning == false)
45+
{
46+
Console.Write("Reasoning > ");
47+
reasoning = true;
48+
}
49+
50+
Console.Write(choice.Message.ReasoningContent);
51+
continue;
52+
}
53+
54+
if (reasoning)
55+
{
56+
reasoning = false;
57+
Console.WriteLine();
58+
Console.Write("Assistant > ");
59+
}
60+
61+
if (choice.Message.Content.Count == 0)
62+
{
63+
continue;
64+
}
65+
66+
Console.Write(choice.Message.Content[0].Text);
67+
reply.Append(choice.Message.Content[0].Text);
68+
usage = chunk.Usage;
69+
}
70+
71+
Console.WriteLine();
72+
messages.Add(MultimodalMessage.Assistant([MultimodalMessageContent.TextContent(reply.ToString())]));
73+
if (usage != null)
74+
{
75+
Console.WriteLine(
76+
$"Usage: in({usage.InputTokens})/out({usage.OutputTokens})/image({usage.ImageTokens})/reasoning({usage.OutputTokensDetails?.ReasoningTokens})/total({usage.TotalTokens})");
77+
}
78+
}
79+
}

0 commit comments

Comments
 (0)